@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 expiration policy.
|
Modifier and Type | Method and Description |
---|---|
Optional<Policy.Eviction<K,V>> |
eviction()
Returns access to perform operations based on the maximum size or maximum weight eviction
policy.
|
Optional<Policy.Expiration<K,V>> |
expireAfterAccess()
Returns access to perform operations based on the time-to-idle expiration policy.
|
Optional<Policy.Expiration<K,V>> |
expireAfterWrite()
Returns access to perform operations based on the time-to-live expiration policy.
|
Optional<Policy.Expiration<K,V>> |
refreshAfterWrite()
Returns access to perform operations based on the time-to-live refresh policy.
|
@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.
@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.