Package io.micronaut.cache.hazelcast
Class HazelcastAsyncCache
java.lang.Object
io.micronaut.cache.hazelcast.HazelcastAsyncCache
- All Implemented Interfaces:
- AsyncCache<com.hazelcast.map.IMap<Object,,- Object>> - Cache<com.hazelcast.map.IMap<Object,- Object>> 
public class HazelcastAsyncCache
extends Object
implements AsyncCache<com.hazelcast.map.IMap<Object,Object>> 
A 
AsyncCache implementation based on Hazelcast.- Since:
- 1.0.0
- Author:
- Nirav Assar
- 
Constructor SummaryConstructorsConstructorDescriptionHazelcastAsyncCache(io.micronaut.core.convert.ConversionService conversionService, com.hazelcast.map.IMap<Object, Object> nativeCache, ExecutorService executorService) 
- 
Method SummaryModifier 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.getName()com.hazelcast.map.IMapinvalidate(@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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.cache.AsyncCacheget, getMethods inherited from interface io.micronaut.cache.CachegetCacheInfo
- 
Constructor Details- 
HazelcastAsyncCachepublic HazelcastAsyncCache(io.micronaut.core.convert.ConversionService conversionService, com.hazelcast.map.IMap<Object, Object> nativeCache, ExecutorService executorService) - Parameters:
- conversionService- the conversion service
- nativeCache- the native cache
- executorService- managers the pool of executors
 
 
- 
- 
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:AsyncCacheResolve the given value for the given key.- Specified by:
- getin interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Type Parameters:
- T- The concrete type
- Parameters:
- key- The cache key
- requiredType- The required type
- Returns:
- An optional containing the value if it exists and is able to be converted to the specified type
 
- 
getpublic <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:AsyncCacheResolve the given value for the given key. If the value is not found the specifiedSupplierwill be invoked and the return value cached.- Specified by:
- getin interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Type Parameters:
- T- The concrete type
- Parameters:
- key- The cache key
- requiredType- The required type
- supplier- 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:AsyncCacheCache the specified value using the specified key if it is not already present. - Specified by:
- putIfAbsentin interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Type Parameters:
- T- The concrete type
- Parameters:
- key- The key with which the specified value is to be associated
- value- 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
 
- 
putDescription copied from interface:AsyncCacheCache the specified value using the specified key. - Specified by:
- putin interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Parameters:
- key- The key with which the specified value is to be associated
- value- The value to be associated with the specified key
- Returns:
- A future with a boolean indicating whether the operation was successful or not
 
- 
invalidateDescription copied from interface:AsyncCacheInvalidate the value for the given key.- Specified by:
- invalidatein interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Parameters:
- key- The key to invalid
- Returns:
- A future with a boolean indicating whether the operation was succesful or not
 
- 
invalidateAllDescription copied from interface:AsyncCacheInvalidate all cached values within this cache.- Specified by:
- invalidateAllin interface- AsyncCache<com.hazelcast.map.IMap<Object,- Object>> 
- Returns:
- A future with a boolean indicating whether the operation was succesful or not
 
- 
getName
- 
getNativeCachepublic com.hazelcast.map.IMap getNativeCache()- Specified by:
- getNativeCachein interface- Cache<com.hazelcast.map.IMap<Object,- Object>> 
- Returns:
- The native cache implementation
 
 
-