Class CacheConfig

java.lang.Object
org.redisson.spring.cache.CacheConfig

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

    • 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 Details

    • 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.
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(String content) throws IOException
      Read config objects stored in JSON format from String
      Parameters:
      content - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException
      Read config objects stored in JSON format from InputStream
      Parameters:
      inputStream - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(File file) throws IOException
      Read config objects stored in JSON format from File
      Parameters:
      file - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(URL url) throws IOException
      Read config objects stored in JSON format from URL
      Parameters:
      url - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(Reader reader) throws IOException
      Read config objects stored in JSON format from Reader
      Parameters:
      reader - of config
      Returns:
      config
      Throws:
      IOException - error
    • toJSON

      public static String toJSON(Map<String,? extends CacheConfig> config) throws IOException
      Convert current configuration to JSON format
      Parameters:
      config - object
      Returns:
      json string
      Throws:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(String content) throws IOException
      Read config objects stored in YAML format from String
      Parameters:
      content - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(InputStream inputStream) throws IOException
      Read config objects stored in YAML format from InputStream
      Parameters:
      inputStream - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(File file) throws IOException
      Read config objects stored in YAML format from File
      Parameters:
      file - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(URL url) throws IOException
      Read config objects stored in YAML format from URL
      Parameters:
      url - of config
      Returns:
      config
      Throws:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(Reader reader) throws IOException
      Read config objects stored in YAML format from Reader
      Parameters:
      reader - of config
      Returns:
      config
      Throws:
      IOException - error
    • toYAML

      public static String toYAML(Map<String,? extends CacheConfig> config) throws IOException
      Convert current configuration to YAML format
      Parameters:
      config - map
      Returns:
      yaml string
      Throws:
      IOException - error