public class HazelcastAsyncCache extends Object implements AsyncCache<com.hazelcast.map.IMap<Object,Object>>
AsyncCache
implementation based on Hazelcast.Constructor and Description |
---|
HazelcastAsyncCache(io.micronaut.core.convert.ConversionService<?> conversionService,
com.hazelcast.map.IMap<Object,Object> nativeCache,
ExecutorService executorService) |
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.
|
String |
getName() |
com.hazelcast.map.IMap |
getNativeCache() |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get
getCacheInfo
public HazelcastAsyncCache(io.micronaut.core.convert.ConversionService<?> conversionService, com.hazelcast.map.IMap<Object,Object> nativeCache, ExecutorService executorService)
conversionService
- the conversion servicenativeCache
- the native cacheexecutorService
- managers the pool of executors@NonNull public <T> CompletableFuture<Optional<T>> get(@NonNull Object key, @NonNull io.micronaut.core.type.Argument<T> requiredType)
AsyncCache
get
in interface AsyncCache<com.hazelcast.map.IMap<Object,Object>>
T
- The concrete typekey
- The cache keyrequiredType
- The required typepublic <T> CompletableFuture<T> get(@NonNull Object key, @NonNull io.micronaut.core.type.Argument<T> requiredType, @NonNull Supplier<T> supplier)
AsyncCache
Supplier
will
be invoked and the return value cached.get
in interface AsyncCache<com.hazelcast.map.IMap<Object,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> CompletableFuture<Optional<T>> putIfAbsent(@NonNull Object key, @NonNull T value)
AsyncCache
Cache the specified value using the specified key if it is not already present.
putIfAbsent
in interface AsyncCache<com.hazelcast.map.IMap<Object,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 CompletableFuture<Boolean> put(@NonNull Object key, @NonNull Object value)
AsyncCache
Cache the specified value using the specified key.
put
in interface AsyncCache<com.hazelcast.map.IMap<Object,Object>>
key
- The key with which the specified value is to be associatedvalue
- The value to be associated with the specified keypublic CompletableFuture<Boolean> invalidate(@NonNull Object key)
AsyncCache
invalidate
in interface AsyncCache<com.hazelcast.map.IMap<Object,Object>>
key
- The key to invalidpublic CompletableFuture<Boolean> invalidateAll()
AsyncCache
invalidateAll
in interface AsyncCache<com.hazelcast.map.IMap<Object,Object>>
public String getName()
public com.hazelcast.map.IMap getNativeCache()
getNativeCache
in interface Cache<com.hazelcast.map.IMap<Object,Object>>