public interface Policy<K,V>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Policy.Eviction<K,V>
The low-level operations for a cache with a size-based eviction policy.
|
static interface |
Policy.Expiration<K,V>
The low-level operations for a cache with a fixed expiration policy.
|
static interface |
Policy.VarExpiration<K,V>
The low-level operations for a cache with a variable expiration policy.
|
| Modifier and Type | Method and Description |
|---|---|
@NonNull Optional<Policy.Eviction<K,V>> |
eviction()
Returns access to perform operations based on the maximum size or maximum weight eviction
policy.
|
@NonNull Optional<Policy.Expiration<K,V>> |
expireAfterAccess()
Returns access to perform operations based on the time-to-idle expiration policy.
|
@NonNull Optional<Policy.Expiration<K,V>> |
expireAfterWrite()
Returns access to perform operations based on the time-to-live expiration policy.
|
default @NonNull Optional<Policy.VarExpiration<K,V>> |
expireVariably()
Returns access to perform operations based on the variable expiration policy.
|
default V |
getIfPresentQuietly(@NonNull Object key)
Returns the value associated with the
key in this cache, or null if there is no
cached value for the key. |
boolean |
isRecordingStats()
Returns whether the cache statistics are being accumulated.
|
@NonNull Optional<Policy.Expiration<K,V>> |
refreshAfterWrite()
Returns access to perform operations based on the time-to-live refresh policy.
|
boolean isRecordingStats()
default V getIfPresentQuietly(@CompatibleWith(value="K") @NonNull Object key)
key in this cache, or null if there is no
cached value for the key. Unlike Cache.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.key - the key whose associated value is to be returnednull if this cache contains
no mapping for the keyNullPointerException - if the specified key is null@NonNull Optional<Policy.Eviction<K,V>> eviction()
Optional is returned.@NonNull Optional<Policy.Expiration<K,V>> expireAfterAccess()
Cache.asMap().get(Object) and Cache.asMap().put(K, V)), but not by operations
on the collection-views of Cache.asMap().
If the cache was not constructed with access-based expiration or the implementation does not
support these operations, an empty Optional is returned.
@NonNull Optional<Policy.Expiration<K,V>> expireAfterWrite()
If the cache was not constructed with write-based expiration or the implementation does not
support these operations, an empty Optional is returned.
default @NonNull Optional<Policy.VarExpiration<K,V>> expireVariably()
If the cache was not constructed with variable expiration or the implementation does not
support these operations, an empty Optional is returned.
@NonNull Optional<Policy.Expiration<K,V>> refreshAfterWrite()
If the cache was not constructed with write-based refresh or the implementation does not
support these operations, an empty Optional is returned.