类 CacheConfig

java.lang.Object
cn.taketoday.cache.CacheConfig

public class CacheConfig extends Object
Cache config object used for cache configuration.
从以下版本开始:
4.0 2022/3/9 21:20
作者:
Nikita Koksharov, Harry Yang
  • 字段详细资料

    • ttl

      private long ttl
    • maxIdleTime

      private long maxIdleTime
    • maxSize

      private int maxSize
  • 构造器详细资料

    • CacheConfig

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

      public CacheConfig(long ttl, long maxIdleTime)
      Creates config object.
      参数:
      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.

  • 方法详细资料

    • getTTL

      public long getTTL()
    • setTTL

      public void setTTL(long ttl)
      Set time to live for key\value entry in milliseconds.
      参数:
      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.
      参数:
      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.
      参数:
      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
      参数:
      content - of config
      返回:
      config
      抛出:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException
      Read config objects stored in JSON format from InputStream
      参数:
      inputStream - of config
      返回:
      config
      抛出:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(File file) throws IOException
      Read config objects stored in JSON format from File
      参数:
      file - of config
      返回:
      config
      抛出:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(URL url) throws IOException
      Read config objects stored in JSON format from URL
      参数:
      url - of config
      返回:
      config
      抛出:
      IOException - error
    • fromJSON

      public static Map<String,? extends CacheConfig> fromJSON(Reader reader) throws IOException
      Read config objects stored in JSON format from Reader
      参数:
      reader - of config
      返回:
      config
      抛出:
      IOException - error
    • toJSON

      public static String toJSON(Map<String,? extends CacheConfig> config) throws IOException
      Convert current configuration to JSON format
      参数:
      config - object
      返回:
      json string
      抛出:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(String content) throws IOException
      Read config objects stored in YAML format from String
      参数:
      content - of config
      返回:
      config
      抛出:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(InputStream inputStream) throws IOException
      Read config objects stored in YAML format from InputStream
      参数:
      inputStream - of config
      返回:
      config
      抛出:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(File file) throws IOException
      Read config objects stored in YAML format from File
      参数:
      file - of config
      返回:
      config
      抛出:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(URL url) throws IOException
      Read config objects stored in YAML format from URL
      参数:
      url - of config
      返回:
      config
      抛出:
      IOException - error
    • fromYAML

      public static Map<String,? extends CacheConfig> fromYAML(Reader reader) throws IOException
      Read config objects stored in YAML format from Reader
      参数:
      reader - of config
      返回:
      config
      抛出:
      IOException - error
    • toYAML

      public static String toYAML(Map<String,? extends CacheConfig> config) throws IOException
      Convert current configuration to YAML format
      参数:
      config - map
      返回:
      yaml string
      抛出:
      IOException - error