类 CacheConfig
java.lang.Object
cn.taketoday.cache.CacheConfig
Cache config object used for cache configuration.
- 从以下版本开始:
- 4.0 2022/3/9 21:20
- 作者:
- Nikita Koksharov, Harry Yang
-
字段概要
字段 -
构造器概要
构造器构造器说明Creates config object withttl = 0andmaxIdleTime = 0.CacheConfig(long ttl, long maxIdleTime) Creates config object. -
方法概要
修饰符和类型方法说明static Map<String,? extends CacheConfig> Read config objects stored in JSON format fromFilestatic Map<String,? extends CacheConfig> fromJSON(InputStream inputStream) Read config objects stored in JSON format fromInputStreamstatic Map<String,? extends CacheConfig> Read config objects stored in JSON format fromReaderstatic Map<String,? extends CacheConfig> Read config objects stored in JSON format fromStringstatic Map<String,? extends CacheConfig> Read config objects stored in JSON format fromURLstatic Map<String,? extends CacheConfig> Read config objects stored in YAML format fromFilestatic Map<String,? extends CacheConfig> fromYAML(InputStream inputStream) Read config objects stored in YAML format fromInputStreamstatic Map<String,? extends CacheConfig> Read config objects stored in YAML format fromReaderstatic Map<String,? extends CacheConfig> Read config objects stored in YAML format fromStringstatic Map<String,? extends CacheConfig> Read config objects stored in YAML format fromURLlongintlonggetTTL()voidsetMaxIdleTime(long maxIdleTime) Set max idle time for key\value entry in milliseconds.voidsetMaxSize(int maxSize) Set max size of map.voidsetTTL(long ttl) Set time to live for key\value entry in milliseconds.static StringtoJSON(Map<String, ? extends CacheConfig> config) Convert current configuration to JSON formatstatic StringtoYAML(Map<String, ? extends CacheConfig> config) Convert current configuration to YAML format
-
字段详细资料
-
ttl
private long ttl -
maxIdleTime
private long maxIdleTime -
maxSize
private int maxSize
-
-
构造器详细资料
-
CacheConfig
public CacheConfig()Creates config object withttl = 0andmaxIdleTime = 0. -
CacheConfig
public CacheConfig(long ttl, long maxIdleTime) Creates config object.- 参数:
ttl- - time to live for key\value entry in milliseconds. If0then time to live doesn't affect entry expiration.maxIdleTime- - max idle time for key\value entry in milliseconds.if
maxIdleTimeandttlparams are equal to0then 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. If0then 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 If0the 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. If0then max idle time doesn't affect entry expiration.
-
fromJSON
Read config objects stored in JSON format fromString- 参数:
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 fromInputStream- 参数:
inputStream- of config- 返回:
- config
- 抛出:
IOException- error
-
fromJSON
Read config objects stored in JSON format fromFile- 参数:
file- of config- 返回:
- config
- 抛出:
IOException- error
-
fromJSON
Read config objects stored in JSON format fromURL- 参数:
url- of config- 返回:
- config
- 抛出:
IOException- error
-
fromJSON
Read config objects stored in JSON format fromReader- 参数:
reader- of config- 返回:
- config
- 抛出:
IOException- error
-
toJSON
Convert current configuration to JSON format- 参数:
config- object- 返回:
- json string
- 抛出:
IOException- error
-
fromYAML
Read config objects stored in YAML format fromString- 参数:
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 fromInputStream- 参数:
inputStream- of config- 返回:
- config
- 抛出:
IOException- error
-
fromYAML
Read config objects stored in YAML format fromFile- 参数:
file- of config- 返回:
- config
- 抛出:
IOException- error
-
fromYAML
Read config objects stored in YAML format fromURL- 参数:
url- of config- 返回:
- config
- 抛出:
IOException- error
-
fromYAML
Read config objects stored in YAML format fromReader- 参数:
reader- of config- 返回:
- config
- 抛出:
IOException- error
-
toYAML
Convert current configuration to YAML format- 参数:
config- map- 返回:
- yaml string
- 抛出:
IOException- error
-