Class AbstractRedisCacheConfiguration

java.lang.Object
io.micronaut.configuration.lettuce.cache.AbstractRedisCacheConfiguration
Direct Known Subclasses:
DefaultRedisCacheConfiguration, RedisCacheConfiguration

public abstract class AbstractRedisCacheConfiguration extends Object
Allows configuration of caches stored in Redis.
Since:
1.3
Author:
Graeme Rocher, Alex Katlein
  • Field Details

    • server

      protected String server
    • keySerializer

      protected Class<io.micronaut.core.serialize.ObjectSerializer> keySerializer
    • valueSerializer

      protected Class<io.micronaut.core.serialize.ObjectSerializer> valueSerializer
    • charset

      protected Charset charset
    • expireAfterWrite

      protected Duration expireAfterWrite
    • expireAfterAccess

      protected Duration expireAfterAccess
    • expirationAfterWritePolicy

      protected String expirationAfterWritePolicy
    • invalidateScanCount

      protected Long invalidateScanCount
  • Constructor Details

    • AbstractRedisCacheConfiguration

      public AbstractRedisCacheConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration)
      Constructor.
      Parameters:
      applicationConfiguration - applicationConfiguration
  • Method Details

    • getServer

      public Optional<String> getServer()
      Returns:
      The name of the server to use.
      See Also:
    • getValueSerializer

      public Optional<Class<io.micronaut.core.serialize.ObjectSerializer>> getValueSerializer()
      Returns:
      The ObjectSerializer type to use for serializing values.
    • getKeySerializer

      public Optional<Class<io.micronaut.core.serialize.ObjectSerializer>> getKeySerializer()
      The ObjectSerializer to use for serializing keys. Defaults to DefaultStringKeySerializer.
      Returns:
      The optional ObjectSerializer class
    • getExpireAfterWrite

      public Optional<Duration> getExpireAfterWrite()
      Returns:
      The expiry to use after the value is written
    • getExpireAfterAccess

      public Optional<Duration> getExpireAfterAccess()
      Specifies 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 Duration
    • getExpirationAfterWritePolicy

      public Optional<String> getExpirationAfterWritePolicy()
      Returns:
      The class path for an implementation of ExpirationAfterWritePolicy
    • getCharset

      public Charset getCharset()
      Returns:
      The charset used to serialize and deserialize values
    • setExpireAfterWrite

      public void setExpireAfterWrite(Duration expireAfterWrite)
      Parameters:
      expireAfterWrite - The cache expiration duration after writing into it.
    • setExpireAfterAccess

      public void setExpireAfterAccess(Duration expireAfterAccess)
      Parameters:
      expireAfterAccess - The cache expiration duration after accessing it
    • setCharset

      public void setCharset(Charset charset)
      Parameters:
      charset - The charset used to serialize and deserialize values
    • setExpirationAfterWritePolicy

      public void setExpirationAfterWritePolicy(String expirationAfterWritePolicy)
      Parameters:
      expirationAfterWritePolicy - The class path for an implementation of ExpirationAfterWritePolicy
    • getInvalidateScanCount

      public Optional<Long> getInvalidateScanCount()
      Returns the count used for the scan command in RedisCache.invalidateAll(). See ScanArgs.limit(long). Defaults to 100L.
      Returns:
      the count setting used in the redis scan in RedisCache.invalidateAll().
      Since:
      6.5.0
    • setInvalidateScanCount

      public void setInvalidateScanCount(@NonNull @NonNull Long invalidateScanCount)
      Sets the count used for the scan command in RedisCache.invalidateAll(). See ScanArgs.limit(long). Defaults to 100L.
      Parameters:
      invalidateScanCount - the count setting to use with the redis scan in RedisCache.invalidateAll().
      Since:
      6.5.0