Package io.micronaut.cache.infinispan
Class InfinispanAsyncCache
java.lang.Object
io.micronaut.cache.infinispan.InfinispanAsyncCache
- All Implemented Interfaces:
AsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
,Object>> Cache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>>
public class InfinispanAsyncCache
extends Object
implements AsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,Object>>
An
AsyncCache
implementation based on Infinispan's AsyncCache
.- Since:
- 1.0.0
- Author:
- Álvaro Sánchez-Mariscal
-
Constructor Summary
ConstructorDescriptionInfinispanAsyncCache
(org.infinispan.client.hotrod.RemoteCache<Object, Object> nativeCache, io.micronaut.core.convert.ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull CompletableFuture<Optional<T>>
Resolve the given value for the given key.<T> CompletableFuture<T>
get
(@NonNull Object key, @NonNull io.micronaut.core.type.Argument<T> requiredType, @NonNull Supplier<T> supplier) Resolve the given value for the given key.org.reactivestreams.Publisher<CacheInfo>
getName()
invalidate
(@NonNull 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> @NonNull CompletableFuture<Optional<T>>
putIfAbsent
(@NonNull Object key, T value) Cache the specified value using the specified key if it is not already present.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.cache.AsyncCache
get, get
-
Constructor Details
-
Method Details
-
get
@NonNull public <T> @NonNull CompletableFuture<Optional<T>> get(@NonNull @NonNull Object key, @NonNull @NonNull io.micronaut.core.type.Argument<T> requiredType) Description copied from interface:AsyncCache
Resolve the given value for the given key.- Specified by:
get
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - 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
public <T> CompletableFuture<T> get(@NonNull @NonNull Object key, @NonNull @NonNull io.micronaut.core.type.Argument<T> requiredType, @NonNull @NonNull Supplier<T> supplier) Description copied from interface:AsyncCache
Resolve the given value for the given key. If the value is not found the specifiedSupplier
will be invoked and the return value cached.- Specified by:
get
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - 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
@NonNull public <T> @NonNull CompletableFuture<Optional<T>> putIfAbsent(@NonNull @NonNull Object key, @NonNull T value) Description copied from interface:AsyncCache
Cache the specified value using the specified key if it is not already present.
- Specified by:
putIfAbsent
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - 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
Description copied from interface:AsyncCache
Cache the specified value using the specified key.
- Specified by:
put
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - 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
Description copied from interface:AsyncCache
Invalidate the value for the given key.- Specified by:
invalidate
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - Parameters:
key
- The key to invalid- Returns:
- A future with a boolean indicating whether the operation was succesful or not
-
invalidateAll
Description copied from interface:AsyncCache
Invalidate all cached values within this cache.- Specified by:
invalidateAll
in interfaceAsyncCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - Returns:
- A future with a boolean indicating whether the operation was succesful or not
-
getCacheInfo
- Specified by:
getCacheInfo
in interfaceCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - Returns:
- The cache information.
-
getName
-
getNativeCache
- Specified by:
getNativeCache
in interfaceCache<org.infinispan.client.hotrod.RemoteCache<Object,
Object>> - Returns:
- The native cache implementation
-