Class CacheConfig


  • public class CacheConfig
    extends Object
    Cache config object used for Spring cache configuration.
    Author:
    Nikita Koksharov
    • Constructor Detail

      • CacheConfig

        public CacheConfig()
        Creates config object with ttl = 0 and maxIdleTime = 0.
      • CacheConfig

        public CacheConfig(long ttl,
                           long maxIdleTime)
        Creates config object.
        Parameters:
        ttl - - time to live for key\value entry in milliseconds. If 0 then time to live doesn't affect entry expiration.
        maxIdleTime - - max idle time for key\value entry in milliseconds.

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

    • Method Detail

      • getTTL

        public long getTTL()
      • setTTL

        public void setTTL(long ttl)
        Set time to live for key\value entry in milliseconds.
        Parameters:
        ttl - - time to live for key\value entry in milliseconds. If 0 then time to live doesn't affect entry expiration.
      • getMaxSize

        public int getMaxSize()
      • setMaxSize

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

        public long getMaxIdleTime()
      • setMaxIdleTime

        public void setMaxIdleTime(long maxIdleTime)
        Set max idle time for key\value entry in milliseconds.
        Parameters:
        maxIdleTime - - max idle time for key\value entry in milliseconds. If 0 then max idle time doesn't affect entry expiration.