@ThreadSafe
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 |
---|---|
java.util.Optional<Policy.Eviction<K,V>> |
eviction()
Returns access to perform operations based on the maximum size or maximum weight eviction
policy.
|
java.util.Optional<Policy.Expiration<K,V>> |
expireAfterAccess()
Returns access to perform operations based on the time-to-idle expiration policy.
|
java.util.Optional<Policy.Expiration<K,V>> |
expireAfterWrite()
Returns access to perform operations based on the time-to-live expiration policy.
|
default java.util.Optional<Policy.VarExpiration<K,V>> |
expireVariably()
Returns access to perform operations based on the variable expiration policy.
|
boolean |
isRecordingStats()
Returns whether the cache statistics are being accumulated.
|
java.util.Optional<Policy.Expiration<K,V>> |
refreshAfterWrite()
Returns access to perform operations based on the time-to-live refresh policy.
|
boolean isRecordingStats()
@Nonnull java.util.Optional<Policy.Eviction<K,V>> eviction()
Optional
is returned.@Nonnull java.util.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 java.util.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.
@Nonnull default java.util.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 java.util.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.