C
- – The native cache implementationpublic abstract class AbstractRedisCache<C>
extends java.lang.Object
implements io.micronaut.cache.SyncCache<C>, java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected java.lang.Long |
expireAfterAccess |
protected ExpirationAfterWritePolicy |
expireAfterWritePolicy |
static java.lang.String |
INVALID_REDIS_CONNECTION_MESSAGE |
protected io.micronaut.core.serialize.ObjectSerializer |
keySerializer |
protected RedisCacheConfiguration |
redisCacheConfiguration |
protected io.micronaut.core.serialize.ObjectSerializer |
valueSerializer |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRedisCache(DefaultRedisCacheConfiguration defaultRedisCacheConfiguration,
RedisCacheConfiguration redisCacheConfiguration,
io.micronaut.core.convert.ConversionService<?> conversionService,
io.micronaut.context.BeanLocator beanLocator) |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
get(byte[] key,
io.micronaut.core.type.Argument<T> requiredType,
java.util.function.Supplier<T> supplier,
io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> commands) |
<T> java.util.Optional<T> |
get(java.lang.Object key,
io.micronaut.core.type.Argument<T> requiredType) |
protected java.lang.String |
getKeysPattern() |
protected io.lettuce.core.api.async.RedisKeyAsyncCommands<byte[],byte[]> |
getRedisKeyAsyncCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection) |
protected io.lettuce.core.api.sync.RedisKeyCommands<byte[],byte[]> |
getRedisKeyCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection) |
protected io.lettuce.core.api.async.RedisStringAsyncCommands<byte[],byte[]> |
getRedisStringAsyncCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection) |
protected io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> |
getRedisStringCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection) |
protected abstract <T> java.util.Optional<T> |
getValue(io.micronaut.core.type.Argument<T> requiredType,
byte[] serializedKey) |
void |
put(java.lang.Object key,
java.lang.Object value) |
<T> java.util.Optional<T> |
putIfAbsent(java.lang.Object key,
T value) |
protected <T> void |
putValue(byte[] serializedKey,
java.util.Optional<byte[]> serialized,
ExpirationAfterWritePolicy policy,
io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> redisStringCommands,
io.lettuce.core.api.sync.RedisKeyCommands<byte[],byte[]> redisKeyCommands,
T value) |
protected abstract <T> void |
putValue(byte[] serializedKey,
T value) |
protected byte[] |
serializeKey(java.lang.Object key)
Serialize the key.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String INVALID_REDIS_CONNECTION_MESSAGE
protected final io.micronaut.core.serialize.ObjectSerializer keySerializer
protected final io.micronaut.core.serialize.ObjectSerializer valueSerializer
protected final RedisCacheConfiguration redisCacheConfiguration
protected final ExpirationAfterWritePolicy expireAfterWritePolicy
protected final java.lang.Long expireAfterAccess
protected AbstractRedisCache(DefaultRedisCacheConfiguration defaultRedisCacheConfiguration, RedisCacheConfiguration redisCacheConfiguration, io.micronaut.core.convert.ConversionService<?> conversionService, io.micronaut.context.BeanLocator beanLocator)
public <T> java.util.Optional<T> get(java.lang.Object key, io.micronaut.core.type.Argument<T> requiredType)
get
in interface io.micronaut.cache.SyncCache<C>
public void put(java.lang.Object key, java.lang.Object value)
put
in interface io.micronaut.cache.SyncCache<C>
public <T> java.util.Optional<T> putIfAbsent(java.lang.Object key, T value)
putIfAbsent
in interface io.micronaut.cache.SyncCache<C>
protected <T> T get(byte[] key, io.micronaut.core.type.Argument<T> requiredType, java.util.function.Supplier<T> supplier, io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> commands)
T
- key
- requiredType
- supplier
- commands
- protected io.lettuce.core.api.async.RedisStringAsyncCommands<byte[],byte[]> getRedisStringAsyncCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection)
connection
- protected io.lettuce.core.api.async.RedisKeyAsyncCommands<byte[],byte[]> getRedisKeyAsyncCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection)
connection
- protected io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> getRedisStringCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection)
connection
- protected io.lettuce.core.api.sync.RedisKeyCommands<byte[],byte[]> getRedisKeyCommands(io.lettuce.core.api.StatefulConnection<byte[],byte[]> connection)
connection
- protected abstract <T> java.util.Optional<T> getValue(io.micronaut.core.type.Argument<T> requiredType, byte[] serializedKey)
T
- requiredType
- serializedKey
- protected abstract <T> void putValue(byte[] serializedKey, T value)
T
- serializedKey
- value
- protected <T> void putValue(byte[] serializedKey, java.util.Optional<byte[]> serialized, ExpirationAfterWritePolicy policy, io.lettuce.core.api.sync.RedisStringCommands<byte[],byte[]> redisStringCommands, io.lettuce.core.api.sync.RedisKeyCommands<byte[],byte[]> redisKeyCommands, T value)
T
- serializedKey
- serialized
- policy
- redisStringCommands
- redisKeyCommands
- value
- protected java.lang.String getKeysPattern()
protected byte[] serializeKey(java.lang.Object key)
key
- The key