Package io.micronaut.cache
Interface AsyncCache<C>
- Type Parameters:
 C- The native cache implementation
- All Superinterfaces:
 Cache<C>
- All Known Implementing Classes:
 DelegatingAsyncBlockingCache,DelegatingAsyncCache,HazelcastAsyncCache,InfinispanAsyncCache
A cache implementation that supports async non-blocking caching operations.
- Since:
 - 1.0
 - Author:
 - Graeme Rocher
 
- 
Method Summary
Modifier and TypeMethodDescription<T> CompletableFuture<Optional<T>>Resolve the given value for the given key.<T> CompletableFuture<T>Resolve the given value for the given key.default <T> CompletableFuture<Optional<T>>Resolve the given value for the given key.default <T> CompletableFuture<T>Resolve the given value for the given key.invalidate(Object key) Invalidate the value for the given key.Invalidate all cached values within this cache.Cache the specified value using the specified key.<T> CompletableFuture<Optional<T>>putIfAbsent(Object key, T value) Cache the specified value using the specified key if it is not already present.Methods inherited from interface io.micronaut.cache.Cache
getCacheInfo, getName, getNativeCache 
- 
Method Details
- 
get
Resolve the given value for the given key.- Type Parameters:
 T- The concrete type- Parameters:
 key- The cache keyrequiredType- The required type- Returns:
 - An optional containing the value if it exists and is able to be converted to the specified type
 
 - 
get
<T> CompletableFuture<T> get(Object key, io.micronaut.core.type.Argument<T> requiredType, Supplier<T> supplier) Resolve the given value for the given key. If the value is not found the specifiedSupplierwill be invoked and the return value cached.- Type Parameters:
 T- The concrete type- Parameters:
 key- The cache keyrequiredType- The required typesupplier- The supplier that should be invoked if the value is not found- Returns:
 - An optional containing the value if it exists and is able to be converted to the specified type
 
 - 
putIfAbsent
Cache the specified value using the specified key if it is not already present.
- Type Parameters:
 T- The concrete type- Parameters:
 key- The key with which the specified value is to be associatedvalue- The value to be associated with the specified key- Returns:
 - An optional of the existing value or 
Optional.empty()if the specified value parameter was cached 
 - 
put
Cache the specified value using the specified key.
- Parameters:
 key- The key with which the specified value is to be associatedvalue- The value to be associated with the specified key- Returns:
 - A future with a boolean indicating whether the operation was successful or not
 
 - 
invalidate
Invalidate the value for the given key.- Parameters:
 key- The key to invalid- Returns:
 - A future with a boolean indicating whether the operation was succesful or not
 
 - 
invalidateAll
CompletableFuture<Boolean> invalidateAll()Invalidate all cached values within this cache.- Returns:
 - A future with a boolean indicating whether the operation was succesful or not
 
 - 
get
Resolve the given value for the given key.- Type Parameters:
 T- The concrete type- Parameters:
 key- The cache keyrequiredType- The required type- Returns:
 - An optional containing the value if it exists and is able to be converted to the specified type
 
 - 
get
Resolve the given value for the given key. If the value is not found the specifiedSupplierwill be invoked and the return value cached.- Type Parameters:
 T- The concrete type- Parameters:
 key- The cache keyrequiredType- The required typesupplier- The supplier that should be invoked if the value is not found- Returns:
 - An optional containing the value if it exists and is able to be converted to the specified type
 
 
 -