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> java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
get(java.lang.Object key,
io.micronaut.core.type.Argument<T> requiredType)
Resolve the given value for the given key.
|
<T> java.util.concurrent.CompletableFuture<T> |
get(java.lang.Object key,
io.micronaut.core.type.Argument<T> requiredType,
java.util.function.Supplier<T> supplier)
Resolve the given value for the given key.
|
default <T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
get(java.lang.Object key,
java.lang.Class<T> requiredType)
Resolve the given value for the given key.
|
default <T> java.util.concurrent.CompletableFuture<T> |
get(java.lang.Object key,
java.lang.Class<T> requiredType,
java.util.function.Supplier<T> supplier)
Resolve the given value for the given key.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
invalidate(java.lang.Object key)
Invalidate the value for the given key.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
invalidateAll()
Invalidate all cached values within this cache.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
put(java.lang.Object key,
java.lang.Object value)
Cache the specified value using the specified key.
|
<T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> |
putIfAbsent(java.lang.Object key,
T value)
Cache the specified value using the specified key if it is not already present.
|
getCacheInfo, getName, getNativeCache
<T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> get(java.lang.Object key, io.micronaut.core.type.Argument<T> requiredType)
T
- The concrete typekey
- The cache keyrequiredType
- The required type<T> java.util.concurrent.CompletableFuture<T> get(java.lang.Object key, io.micronaut.core.type.Argument<T> requiredType, java.util.function.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> java.util.concurrent.CompletableFuture<java.util.Optional<T>> putIfAbsent(java.lang.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 cachedjava.util.concurrent.CompletableFuture<java.lang.Boolean> put(java.lang.Object key, java.lang.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 keyjava.util.concurrent.CompletableFuture<java.lang.Boolean> invalidate(java.lang.Object key)
key
- The key to invalidjava.util.concurrent.CompletableFuture<java.lang.Boolean> invalidateAll()
default <T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> get(java.lang.Object key, java.lang.Class<T> requiredType)
T
- The concrete typekey
- The cache keyrequiredType
- The required typedefault <T> java.util.concurrent.CompletableFuture<T> get(java.lang.Object key, java.lang.Class<T> requiredType, java.util.function.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