C
- The native cache implementationpublic interface AsyncCache<C> extends Cache<C>
A cache implementation that supports async non-blocking caching operations.
Modifier and Type | Method and Description |
---|---|
<T> CompletableFuture<Optional<T>> |
get(Object key,
io.micronaut.core.type.Argument<T> requiredType)
Resolve the given value for the given key.
|
<T> CompletableFuture<T> |
get(Object key,
io.micronaut.core.type.Argument<T> requiredType,
Supplier<T> supplier)
Resolve the given value for the given key.
|
default <T> CompletableFuture<Optional<T>> |
get(Object key,
Class<T> requiredType)
Resolve the given value for the given key.
|
default <T> CompletableFuture<T> |
get(Object key,
Class<T> requiredType,
Supplier<T> supplier)
Resolve the given value for the given key.
|
CompletableFuture<Boolean> |
invalidate(Object key)
Invalidate the value for the given key.
|
CompletableFuture<Boolean> |
invalidateAll()
Invalidate all cached values within this cache.
|
CompletableFuture<Boolean> |
put(Object key,
Object value)
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.
|
getCacheInfo, getName, getNativeCache
<T> CompletableFuture<Optional<T>> get(Object key, io.micronaut.core.type.Argument<T> requiredType)
T
- The concrete typekey
- The cache keyrequiredType
- The required type<T> CompletableFuture<T> get(Object key, io.micronaut.core.type.Argument<T> requiredType, Supplier<T> supplier)
Supplier
will
be invoked and the return value cached.T
- The concrete typekey
- The cache keyrequiredType
- The required typesupplier
- The supplier that should be invoked if the value is not found<T> CompletableFuture<Optional<T>> putIfAbsent(Object key, T value)
Cache the specified value using the specified key if it is not already present.
T
- The concrete typekey
- The key with which the specified value is to be associatedvalue
- The value to be associated with the specified keyOptional.empty()
if the specified value parameter was cachedCompletableFuture<Boolean> put(Object key, Object value)
Cache the specified value using the specified key.
key
- The key with which the specified value is to be associatedvalue
- The value to be associated with the specified keyCompletableFuture<Boolean> invalidate(Object key)
key
- The key to invalidCompletableFuture<Boolean> invalidateAll()
default <T> CompletableFuture<Optional<T>> get(Object key, Class<T> requiredType)
T
- The concrete typekey
- The cache keyrequiredType
- The required typedefault <T> CompletableFuture<T> get(Object key, Class<T> requiredType, Supplier<T> supplier)
Supplier
will
be invoked and the return value cached.T
- The concrete typekey
- The cache keyrequiredType
- The required typesupplier
- The supplier that should be invoked if the value is not found