public class InfinispanAsyncCache extends java.lang.Object implements AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
AsyncCache
implementation based on Infinispan's org.infinispan.commons.api.AsyncCache
.Constructor and Description |
---|
InfinispanAsyncCache(org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object> nativeCache,
io.micronaut.core.convert.ConversionService<?> conversionService) |
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.
|
org.reactivestreams.Publisher<CacheInfo> |
getCacheInfo() |
java.lang.String |
getName() |
org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object> |
getNativeCache() |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get
public InfinispanAsyncCache(org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object> nativeCache, io.micronaut.core.convert.ConversionService<?> conversionService)
nativeCache
- the Infinispan remote cacheconversionService
- the conversion service@Nonnull public <T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> get(@Nonnull java.lang.Object key, @Nonnull io.micronaut.core.type.Argument<T> requiredType)
AsyncCache
get
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
T
- The concrete typekey
- The cache keyrequiredType
- The required typepublic <T> java.util.concurrent.CompletableFuture<T> get(@Nonnull java.lang.Object key, @Nonnull io.micronaut.core.type.Argument<T> requiredType, @Nonnull java.util.function.Supplier<T> supplier)
AsyncCache
Supplier
will
be invoked and the return value cached.get
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
T
- The concrete typekey
- The cache keyrequiredType
- The required typesupplier
- The supplier that should be invoked if the value is not found@Nonnull public <T> java.util.concurrent.CompletableFuture<java.util.Optional<T>> putIfAbsent(@Nonnull java.lang.Object key, @Nonnull T value)
AsyncCache
Cache the specified value using the specified key if it is not already present.
putIfAbsent
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
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 cachedpublic java.util.concurrent.CompletableFuture<java.lang.Boolean> put(@Nonnull java.lang.Object key, @Nonnull java.lang.Object value)
AsyncCache
Cache the specified value using the specified key.
put
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
key
- The key with which the specified value is to be associatedvalue
- The value to be associated with the specified keypublic java.util.concurrent.CompletableFuture<java.lang.Boolean> invalidate(@Nonnull java.lang.Object key)
AsyncCache
invalidate
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
key
- The key to invalidpublic java.util.concurrent.CompletableFuture<java.lang.Boolean> invalidateAll()
AsyncCache
invalidateAll
in interface AsyncCache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
public org.reactivestreams.Publisher<CacheInfo> getCacheInfo()
getCacheInfo
in interface Cache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>
public java.lang.String getName()
public org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object> getNativeCache()
getNativeCache
in interface Cache<org.infinispan.client.hotrod.RemoteCache<java.lang.Object,java.lang.Object>>