Class BaseCacheConfiguration

  • All Implemented Interfaces:
    io.micronaut.core.naming.Named
    Direct Known Subclasses:
    RedissonCacheConfiguration

    public class BaseCacheConfiguration
    extends Object
    implements io.micronaut.core.naming.Named
    Micronaut Cache settings.
    Author:
    Nikita Koksharov
    • Constructor Detail

      • BaseCacheConfiguration

        public BaseCacheConfiguration​(String name)
    • Method Detail

      • getName

        @NonNull
        public String getName()
        Specified by:
        getName in interface io.micronaut.core.naming.Named
      • getCodec

        public Codec getCodec()
      • setCodec

        public void setCodec​(Codec codec)
        Redis data codec applied to cache entries. Default is MarshallingCodec codec
        Parameters:
        codec - - data codec
        See Also:
        Codec, MarshallingCodec
      • getExpireAfterWrite

        public Duration getExpireAfterWrite()
      • setExpireAfterWrite

        public void setExpireAfterWrite​(Duration expireAfterWrite)
        Cache entry time to live duration applied after each write operation.
        Parameters:
        expireAfterWrite - - time to live duration
      • getExpireAfterAccess

        public Duration getExpireAfterAccess()
      • setExpireAfterAccess

        public void setExpireAfterAccess​(Duration expireAfterAccess)
        Cache entry time to live duration applied after each read operation.
        Parameters:
        expireAfterAccess - - time to live duration
      • getMaxSize

        public int getMaxSize()
      • setMaxSize

        public void setMaxSize​(int maxSize)
        Max size of this cache. Superfluous elements are evicted using LRU algorithm.
        Parameters:
        maxSize - - max size If 0 the cache is unbounded (default).
      • setWriteBehindBatchSize

        public void setWriteBehindBatchSize​(int writeBehindBatchSize)
        Sets write behind tasks batch size. During MapWriter methods execution all updates accumulated into a batch of specified size.

        Default is 50

        Parameters:
        writeBehindBatchSize - - size of batch
      • setWriteBehindDelay

        public void setWriteBehindDelay​(int writeBehindDelay)
        Sets write behind tasks execution delay. All updates would be applied with lag not more than specified delay.

        Default is 1000 milliseconds

        Parameters:
        writeBehindDelay - - delay in milliseconds
      • setWriter

        public void setWriter​(MapWriter<Object,​Object> writer)
        Sets MapWriter object used for write-through operations.
        Parameters:
        writer - object
      • setLoader

        public void setLoader​(MapLoader<Object,​Object> loader)
        Sets MapLoader object used to load entries during read-operations execution.
        Parameters:
        loader - object