@EachBean(value=RedisCacheConfiguration.class) @Requires(classes=io.micronaut.cache.SyncCache.class, property="redis.pool.enabled", defaultValue="false", notEquals="false") public class RedisConnectionPoolCache extends AbstractRedisCache<io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>>>
SyncCache
for Lettuce / Redis using connection pooling.Modifier and Type | Class and Description |
---|---|
protected class |
RedisConnectionPoolCache.RedisAsyncCache
Redis Async cache implementation.
|
expireAfterAccess, expireAfterWritePolicy, INVALID_REDIS_CONNECTION_MESSAGE, keySerializer, redisCacheConfiguration, valueSerializer
Constructor and Description |
---|
RedisConnectionPoolCache(DefaultRedisCacheConfiguration defaultRedisCacheConfiguration,
RedisCacheConfiguration redisCacheConfiguration,
io.micronaut.core.convert.ConversionService<?> conversionService,
io.micronaut.context.BeanLocator beanLocator,
io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>> asyncPool)
Creates a new redis cache for the given arguments.
|
Modifier and Type | Method and Description |
---|---|
io.micronaut.cache.AsyncCache<io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>>> |
async() |
void |
close() |
<T> T |
get(java.lang.Object key,
io.micronaut.core.type.Argument<T> requiredType,
java.util.function.Supplier<T> supplier) |
java.lang.String |
getName() |
io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>> |
getNativeCache() |
protected <T> java.util.Optional<T> |
getValue(io.micronaut.core.type.Argument<T> requiredType,
byte[] serializedKey)
Get the value based on the parameters.
|
void |
invalidate(java.lang.Object key) |
void |
invalidateAll() |
protected <T> void |
putValue(byte[] serializedKey,
T value)
Place the value in the cache.
|
get, get, getKeysPattern, getRedisKeyAsyncCommands, getRedisKeyCommands, getRedisStringAsyncCommands, getRedisStringCommands, put, putIfAbsent, putValue, serializeKey
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RedisConnectionPoolCache(DefaultRedisCacheConfiguration defaultRedisCacheConfiguration, RedisCacheConfiguration redisCacheConfiguration, io.micronaut.core.convert.ConversionService<?> conversionService, io.micronaut.context.BeanLocator beanLocator, io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>> asyncPool)
defaultRedisCacheConfiguration
- The default configurationredisCacheConfiguration
- The configurationconversionService
- The conversion servicebeanLocator
- The bean locator used to discover the redis connection from the configurationasyncPool
- Redis async poolpublic java.lang.String getName()
public io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>> getNativeCache()
public <T> T get(@NonNull java.lang.Object key, @NonNull io.micronaut.core.type.Argument<T> requiredType, @NonNull java.util.function.Supplier<T> supplier)
public void invalidate(java.lang.Object key)
public void invalidateAll()
public io.micronaut.cache.AsyncCache<io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>>> async()
protected <T> java.util.Optional<T> getValue(io.micronaut.core.type.Argument<T> requiredType, byte[] serializedKey)
getValue
in class AbstractRedisCache<io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>>>
T
- type of the argumentrequiredType
- requiredTypeserializedKey
- serializedKeyprotected <T> void putValue(byte[] serializedKey, T value)
putValue
in class AbstractRedisCache<io.lettuce.core.support.AsyncPool<io.lettuce.core.api.StatefulConnection<byte[],byte[]>>>
T
- type of the valueserializedKey
- serializedKeyvalue
- value@PreDestroy public void close()