Constructor and Description |
---|
EhcacheSyncCache(io.micronaut.core.convert.ConversionService<?> conversionService,
EhcacheConfiguration configuration,
org.ehcache.Cache nativeCache,
java.util.concurrent.ExecutorService executorService,
org.ehcache.core.spi.service.StatisticsService statisticsService) |
Modifier and Type | Method and Description |
---|---|
<T> 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> 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.util.concurrent.ExecutorService |
getExecutorService() |
java.lang.String |
getName() |
org.ehcache.Cache |
getNativeCache() |
void |
invalidate(java.lang.Object key)
Invalidate the value for the given key.
|
void |
invalidateAll()
Invalidate all cached values within this cache.
|
void |
put(java.lang.Object key,
java.lang.Object value)
Cache the specified value using the specified key.
|
<T> 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
async, get, get, putIfAbsent
public EhcacheSyncCache(io.micronaut.core.convert.ConversionService<?> conversionService, EhcacheConfiguration configuration, org.ehcache.Cache nativeCache, @Named(value="io") java.util.concurrent.ExecutorService executorService, org.ehcache.core.spi.service.StatisticsService statisticsService)
conversionService
- the conversion serviceconfiguration
- the configurationnativeCache
- the native cacheexecutorService
- the executor service to offload synchronous operationsstatisticsService
- th Ehcache statistics servicepublic java.util.concurrent.ExecutorService getExecutorService()
getExecutorService
in interface SyncCache<org.ehcache.Cache>
@Nonnull public <T> java.util.Optional<T> get(@Nonnull java.lang.Object key, @Nonnull io.micronaut.core.type.Argument<T> requiredType)
SyncCache
public <T> T get(@Nonnull java.lang.Object key, @Nonnull io.micronaut.core.type.Argument<T> requiredType, @Nonnull java.util.function.Supplier<T> supplier)
SyncCache
Supplier
will
be invoked and the return value cached.get
in interface SyncCache<org.ehcache.Cache>
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.Optional<T> putIfAbsent(@Nonnull java.lang.Object key, @Nonnull T value)
SyncCache
Cache the specified value using the specified key if it is not already present.
putIfAbsent
in interface SyncCache<org.ehcache.Cache>
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 void put(@Nonnull java.lang.Object key, @Nonnull java.lang.Object value)
SyncCache
Cache the specified value using the specified key.
public void invalidate(@Nonnull java.lang.Object key)
SyncCache
invalidate
in interface SyncCache<org.ehcache.Cache>
key
- The key to invalidpublic void invalidateAll()
SyncCache
invalidateAll
in interface SyncCache<org.ehcache.Cache>
public java.lang.String getName()
public org.ehcache.Cache getNativeCache()
getNativeCache
in interface Cache<org.ehcache.Cache>
public org.reactivestreams.Publisher<CacheInfo> getCacheInfo()
getCacheInfo
in interface Cache<org.ehcache.Cache>