Interface CacheConfig.CaffeineConfig.CaffeineCacheConfig

Enclosing interface:
CacheConfig.CaffeineConfig

public static interface CacheConfig.CaffeineConfig.CaffeineCacheConfig
  • Method Summary

    Modifier and Type
    Method
    Description
    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.
    Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.
    Minimum total size for the internal data structures.
    Maximum number of entries the cache may contain.
    Whether or not metrics are recorded if the application depends on the Micrometer extension.
  • Method Details

    • initialCapacity

      OptionalInt initialCapacity()
      Minimum total size for the internal data structures. Providing a large enough estimate at construction time avoids the need for expensive resizing operations later, but setting this value unnecessarily high wastes memory.
    • maximumSize

      OptionalLong maximumSize()
      Maximum number of entries the cache may contain. Note that the cache may evict an entry before this limit is exceeded or temporarily exceed the threshold while evicting. As the cache size grows close to the maximum, the cache evicts entries that are less likely to be used again. For example, the cache may evict an entry because it hasn't been used recently or very often.
    • expireAfterWrite

      Optional<Duration> expireAfterWrite()
      Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.
    • expireAfterAccess

      Optional<Duration> expireAfterAccess()
      Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.
    • metricsEnabled

      Optional<Boolean> metricsEnabled()
      Whether or not metrics are recorded if the application depends on the Micrometer extension. Setting this value to true will enable the accumulation of cache stats inside Caffeine.