Class BoundedLocalCache.BoundedPolicy<K,V>
java.lang.Object
com.github.benmanes.caffeine.cache.BoundedLocalCache.BoundedPolicy<K,V>
- All Implemented Interfaces:
Policy<K,V>
- Enclosing class:
BoundedLocalCache<K,V>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class(package private) final class(package private) final class(package private) final class(package private) final classNested classes/interfaces inherited from interface Policy
Policy.Eviction<K,V>, Policy.Expiration<K, V>, Policy.VarExpiration<K, V> -
Field Summary
FieldsModifier and TypeFieldDescription(package private) @Nullable Optional<Policy.Expiration<K, V>> (package private) @Nullable Optional<Policy.Expiration<K, V>> (package private) final BoundedLocalCache<K, V> (package private) @Nullable Optional<Policy.Eviction<K, V>> (package private) final boolean(package private) @Nullable Optional<Policy.Expiration<K, V>> (package private) @Nullable Optional<Policy.VarExpiration<K, V>> -
Constructor Summary
ConstructorsConstructorDescriptionBoundedPolicy(BoundedLocalCache<K, V> cache, Function<V, V> transformer, boolean isWeighted) -
Method Summary
Modifier and TypeMethodDescriptioneviction()Returns access to perform operations based on the maximum size or maximum weight eviction policy.Returns access to perform operations based on the time-to-idle expiration policy.Returns access to perform operations based on the time-to-live expiration policy.Returns access to perform operations based on the variable expiration policy.@Nullable VReturns the value associated with thekeyin this cache, ornullif there is no cached value for thekey.booleanReturns whether the cache statistics are being accumulated.Returns access to perform operations based on the time-to-live refresh policy.
-
Field Details
-
cache
-
transformer
-
isWeighted
final boolean isWeighted -
eviction
@Nullable Optional<Policy.Eviction<K,V>> eviction -
refreshes
@Nullable Optional<Policy.Expiration<K,V>> refreshes -
afterWrite
@Nullable Optional<Policy.Expiration<K,V>> afterWrite -
afterAccess
@Nullable Optional<Policy.Expiration<K,V>> afterAccess -
variable
@Nullable Optional<Policy.VarExpiration<K,V>> variable
-
-
Constructor Details
-
BoundedPolicy
-
-
Method Details
-
isRecordingStats
public boolean isRecordingStats()Description copied from interface:PolicyReturns whether the cache statistics are being accumulated.- Specified by:
isRecordingStatsin interfacePolicy<K,V> - Returns:
- if cache statistics are being recorded
-
getIfPresentQuietly
Description copied from interface:PolicyReturns the value associated with thekeyin this cache, ornullif there is no cached value for thekey. UnlikeCache.getIfPresent(Object), this method does not produce any side effects such as updating statistics, the eviction policy, reseting the expiration time, or triggering a refresh.- Specified by:
getIfPresentQuietlyin interfacePolicy<K,V> - Parameters:
key- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
nullif this cache contains no mapping for the key
-
eviction
-
expireAfterAccess
Description copied from interface:PolicyReturns access to perform operations based on the time-to-idle expiration policy. This policy determines that an 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 access. Access time is reset by all cache read and write operations (includingCache.asMap().get(Object)andCache.asMap().put(K, V)), but not by operations on the collection-views ofCache.asMap().If the cache was not constructed with access-based expiration or the implementation does not support these operations, an empty
Optionalis returned.- Specified by:
expireAfterAccessin interfacePolicy<K,V> - Returns:
- access to low-level operations for this cache if a time-to-idle expiration policy is used
-
expireAfterWrite
Description copied from interface:PolicyReturns access to perform operations based on the time-to-live expiration policy. This policy determines that an 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.If the cache was not constructed with write-based expiration or the implementation does not support these operations, an empty
Optionalis returned.- Specified by:
expireAfterWritein interfacePolicy<K,V> - Returns:
- access to low-level operations for this cache if a time-to-live expiration policy is used
-
expireVariably
Description copied from interface:PolicyReturns access to perform operations based on the variable expiration policy. This policy determines that an entry should be automatically removed from the cache once a per-entry duration has elapsed.If the cache was not constructed with variable expiration or the implementation does not support these operations, an empty
Optionalis returned.- Specified by:
expireVariablyin interfacePolicy<K,V> - Returns:
- access to low-level operations for this cache if a variable expiration policy is used
-
refreshAfterWrite
Description copied from interface:PolicyReturns access to perform operations based on the time-to-live refresh policy. This policy determines that an entry should be automatically reloaded once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.If the cache was not constructed with write-based refresh or the implementation does not support these operations, an empty
Optionalis returned.- Specified by:
refreshAfterWritein interfacePolicy<K,V> - Returns:
- access to low-level operations for this cache if a time-to-live refresh policy is used
-