Class AbstractRedisCacheConfiguration
java.lang.Object
io.micronaut.configuration.lettuce.cache.AbstractRedisCacheConfiguration
- Direct Known Subclasses:
DefaultRedisCacheConfiguration, RedisCacheConfiguration
Allows configuration of caches stored in Redis.
- Since:
- 1.3
- Author:
- Graeme Rocher, Alex Katlein
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Charsetprotected Stringprotected Durationprotected Durationprotected Integerprotected Longprotected Class<io.micronaut.core.serialize.ObjectSerializer> protected Stringprotected Integerprotected Stringprotected Class<io.micronaut.core.serialize.ObjectSerializer> -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRedisCacheConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.Returns the count used for the scan command inRedisCache.invalidateAll().TheObjectSerializerto use for serializing keys.voidsetCharset(Charset charset) voidsetExpirationAfterWritePolicy(String expirationAfterWritePolicy) voidsetExpireAfterAccess(Duration expireAfterAccess) voidsetExpireAfterWrite(Duration expireAfterWrite) voidsetInsertRetries(@NonNull Integer insertRetries) voidsetInvalidateScanCount(@NonNull Long invalidateScanCount) Sets the count used for the scan command inRedisCache.invalidateAll().voidsetKeySerializer(Class<io.micronaut.core.serialize.ObjectSerializer> keySerializer) Sets theObjectSerializerto use for serializing keys.voidsetNamespace(String namespace) Sets the namespace to prefix cache keys with.voidsetReadRetries(@NonNull Integer readRetries) voidSets the name of the server to use.voidsetValueSerializer(Class<io.micronaut.core.serialize.ObjectSerializer> valueSerializer) Sets theObjectSerializerto use for serializing values.
-
Field Details
-
server
-
keySerializer
-
valueSerializer
-
charset
-
expireAfterWrite
-
expireAfterAccess
-
expirationAfterWritePolicy
-
invalidateScanCount
-
namespace
-
readRetries
-
insertRetries
-
-
Constructor Details
-
AbstractRedisCacheConfiguration
public AbstractRedisCacheConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor.- Parameters:
applicationConfiguration- applicationConfiguration
-
-
Method Details
-
getServer
-
getValueSerializer
-
getKeySerializer
-
getExpireAfterWrite
-
getExpireAfterAccess
-
getExpirationAfterWritePolicy
-
getNamespace
-
getCharset
- Returns:
- The charset used to serialize and deserialize values
-
setServer
Sets the name of the server to use.- Parameters:
server- The server name
-
setKeySerializer
Sets theObjectSerializerto use for serializing keys.- Parameters:
keySerializer- The key serializer
-
setValueSerializer
Sets theObjectSerializerto use for serializing values.- Parameters:
valueSerializer- The value serializer
-
setExpireAfterWrite
- Parameters:
expireAfterWrite- The cache expiration duration after writing into it.
-
setExpireAfterAccess
- Parameters:
expireAfterAccess- The cache expiration duration after accessing it
-
setCharset
- Parameters:
charset- The charset used to serialize and deserialize values
-
setExpirationAfterWritePolicy
- Parameters:
expirationAfterWritePolicy- The class path for an implementation of ExpirationAfterWritePolicy
-
setNamespace
Sets the namespace to prefix cache keys with.- Parameters:
namespace- The namespace
-
getInvalidateScanCount
Returns the count used for the scan command inRedisCache.invalidateAll(). SeeScanArgs.limit(long). Defaults to 100L.- Returns:
- the count setting used in the redis scan in
RedisCache.invalidateAll(). - Since:
- 6.5.0
-
setInvalidateScanCount
Sets the count used for the scan command inRedisCache.invalidateAll(). SeeScanArgs.limit(long). Defaults to 100L.- Parameters:
invalidateScanCount- the count setting to use with the redis scan inRedisCache.invalidateAll().- Since:
- 6.5.0
-
getReadRetries
-
setReadRetries
- Parameters:
readRetries- The number of times a failed cache read should be retried.- Since:
- 7.0.0
-
getInsertRetries
-
setInsertRetries
- Parameters:
insertRetries- The number of times a failed cache insert should be retried.- Since:
- 7.0.0
-