Interface ICache<K,V>
- Type Parameters:
K- the cache key typeV- the cache value type
- All Superinterfaces:
AutoCloseable, javax.cache.Cache<K,V>, Closeable, Iterable<javax.cache.Cache.Entry<K, V>>
- All Known Implementing Classes:
LoomJCache
public interface ICache<K,V>
extends javax.cache.Cache<K,V>
LoomCache JCache extension interface.
Extends the portable JSR-107 Cache contract with operations that are useful for
cache implementations but not present in the standard API.
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.cache.Cache
javax.cache.Cache.Entry<K,V> -
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<@Nullable V> Asynchronously retrieve a cache entry.Asynchronously store a cache entry.booleansetExpiryPolicy(K key, javax.cache.expiry.ExpiryPolicy expiryPolicy) Associate a live cache entry with a key-specific expiry policy.Methods inherited from interface javax.cache.Cache
clear, close, containsKey, deregisterCacheEntryListener, get, getAll, getAndPut, getAndRemove, getAndReplace, getCacheManager, getConfiguration, getName, invoke, invokeAll, isClosed, iterator, loadAll, put, putAll, putIfAbsent, registerCacheEntryListener, remove, remove, removeAll, removeAll, replace, replace, unwrapMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
setExpiryPolicy
Associate a live cache entry with a key-specific expiry policy.The supplied policy takes precedence over the cache-wide expiry policy for this key. The entry's time-to-live is recalculated immediately from
ExpiryPolicy.getExpiryForUpdate(). If the key is absent or already expired, no policy is stored and the method returnsfalse.- Parameters:
key- the existing cache keyexpiryPolicy- the key-specific expiry policy- Returns:
trueif a live entry was updated,falseotherwise
-
getAsync
Asynchronously retrieve a cache entry.- Parameters:
key- the cache key- Returns:
- a future completed with the value, or
nullif absent
-
putAsync
Asynchronously store a cache entry.- Parameters:
key- the cache keyvalue- the cache value- Returns:
- a future completed when the write finishes
-