Interface CacheConfiguration<K,V>

Type Parameters:
K - the cache key type
V - the cache value type

public interface CacheConfiguration<K,V>
Encapsulates the configuration of a Caffeine cache.
Author:
Paul Ferraro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A builder of a Caffeine cache configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K,V> CacheConfiguration.Builder<K,V>
    Creates a builder of cache configuration.
    Optional<com.github.benmanes.caffeine.cache.RemovalListener<K,V>>
    When present, defines a listener to be notified on entry eviction.
    com.github.benmanes.caffeine.cache.Expiry<K,V>
    Returns the expiry logic of this cache.
    When present, defines the maximum weight for entries within this cache.
    Optional<com.github.benmanes.caffeine.cache.RemovalListener<K,V>>
    When present, defines a listener to be notified on entry removal.
    com.github.benmanes.caffeine.cache.Scheduler
    Returns a scheduler of asynchronous tasks.
    com.github.benmanes.caffeine.cache.Weigher<K,V>
    Returns a weigher of cache entries.
  • Method Details

    • getMaxWeight

      OptionalLong getMaxWeight()
      When present, defines the maximum weight for entries within this cache.
      Returns:
      an optional size-based eviction threshold
    • getExpiry

      com.github.benmanes.caffeine.cache.Expiry<K,V> getExpiry()
      Returns the expiry logic of this cache.
      Returns:
      the expiry logic of this cache.
    • getWeigher

      com.github.benmanes.caffeine.cache.Weigher<K,V> getWeigher()
      Returns a weigher of cache entries.
      Returns:
      a weigher of cache entries.
    • getEvictionListener

      Optional<com.github.benmanes.caffeine.cache.RemovalListener<K,V>> getEvictionListener()
      When present, defines a listener to be notified on entry eviction.
      Returns:
      an optional listener to be notified on entry eviction.
    • getRemovalListener

      Optional<com.github.benmanes.caffeine.cache.RemovalListener<K,V>> getRemovalListener()
      When present, defines a listener to be notified on entry removal.
      Returns:
      an optional listener to be notified on entry removal.
    • getScheduler

      com.github.benmanes.caffeine.cache.Scheduler getScheduler()
      Returns a scheduler of asynchronous tasks.
      Returns:
      a scheduler of asynchronous tasks.
    • builder

      static <K,V> CacheConfiguration.Builder<K,V> builder()
      Creates a builder of cache configuration.
      Type Parameters:
      K - the cache key type
      V - the cache value type
      Returns:
      a builder of cache configuration.