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 SummaryModifier 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.CachegetCacheInfo, getName, getNativeCache
- 
Method Details- 
getResolve the given value for the given key.- Type Parameters:
- T- The concrete type
- Parameters:
- key- The cache key
- requiredType- 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 key
- requiredType- The required type
- supplier- 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
 
- 
putIfAbsentCache 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 associated
- value- 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
 
- 
putCache the specified value using the specified key. - Parameters:
- key- The key with which the specified value is to be associated
- value- The value to be associated with the specified key
- Returns:
- A future with a boolean indicating whether the operation was successful or not
 
- 
invalidateInvalidate 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
 
- 
invalidateAllCompletableFuture<Boolean> invalidateAll()Invalidate all cached values within this cache.- Returns:
- A future with a boolean indicating whether the operation was succesful or not
 
- 
getResolve the given value for the given key.- Type Parameters:
- T- The concrete type
- Parameters:
- key- The cache key
- requiredType- The required type
- Returns:
- An optional containing the value if it exists and is able to be converted to the specified type
 
- 
getResolve 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 key
- requiredType- The required type
- supplier- 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
 
 
-