public class CacheConfig extends Object
| Constructor and Description |
|---|
CacheConfig()
Creates config object with
ttl = 0 and maxIdleTime = 0. |
CacheConfig(long ttl,
long maxIdleTime)
Creates config object.
|
| Modifier and Type | Method and Description |
|---|---|
static Map<String,? extends CacheConfig> |
fromJSON(File file)
Read config objects stored in JSON format from
File |
static Map<String,? extends CacheConfig> |
fromJSON(InputStream inputStream)
Read config objects stored in JSON format from
InputStream |
static Map<String,? extends CacheConfig> |
fromJSON(Reader reader)
Read config objects stored in JSON format from
Reader |
static Map<String,? extends CacheConfig> |
fromJSON(String content)
Read config objects stored in JSON format from
String |
static Map<String,? extends CacheConfig> |
fromJSON(URL url)
Read config objects stored in JSON format from
URL |
static Map<String,? extends CacheConfig> |
fromYAML(File file)
Read config objects stored in YAML format from
File |
static Map<String,? extends CacheConfig> |
fromYAML(InputStream inputStream)
Read config objects stored in YAML format from
InputStream |
static Map<String,? extends CacheConfig> |
fromYAML(Reader reader)
Read config objects stored in YAML format from
Reader |
static Map<String,? extends CacheConfig> |
fromYAML(String content)
Read config objects stored in YAML format from
String |
static Map<String,? extends CacheConfig> |
fromYAML(URL url)
Read config objects stored in YAML format from
URL |
long |
getMaxIdleTime() |
int |
getMaxSize() |
long |
getTTL() |
void |
setMaxIdleTime(long maxIdleTime)
Set max idle time for key\value entry in milliseconds.
|
void |
setMaxSize(int maxSize)
Set max size of map.
|
void |
setTTL(long ttl)
Set time to live for key\value entry in milliseconds.
|
static String |
toJSON(Map<String,? extends CacheConfig> config)
Convert current configuration to JSON format
|
static String |
toYAML(Map<String,? extends CacheConfig> config)
Convert current configuration to YAML format
|
public CacheConfig()
ttl = 0 and maxIdleTime = 0.public CacheConfig(long ttl,
long maxIdleTime)
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.
public long getTTL()
public void setTTL(long ttl)
ttl - - time to live for key\value entry in milliseconds.
If 0 then time to live doesn't affect entry expiration.public int getMaxSize()
public void setMaxSize(int maxSize)
maxSize - - max size
If 0 the cache is unbounded (default).public long getMaxIdleTime()
public void setMaxIdleTime(long maxIdleTime)
maxIdleTime - - max idle time for key\value entry in milliseconds.
If 0 then max idle time doesn't affect entry expiration.public static Map<String,? extends CacheConfig> fromJSON(String content) throws IOException
Stringcontent - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException
InputStreaminputStream - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromJSON(File file) throws IOException
Filefile - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromJSON(URL url) throws IOException
URLurl - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromJSON(Reader reader) throws IOException
Readerreader - of configIOException - errorpublic static String toJSON(Map<String,? extends CacheConfig> config) throws IOException
config - objectIOException - errorpublic static Map<String,? extends CacheConfig> fromYAML(String content) throws IOException
Stringcontent - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromYAML(InputStream inputStream) throws IOException
InputStreaminputStream - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromYAML(File file) throws IOException
Filefile - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromYAML(URL url) throws IOException
URLurl - of configIOException - errorpublic static Map<String,? extends CacheConfig> fromYAML(Reader reader) throws IOException
Readerreader - of configIOException - errorpublic static String toYAML(Map<String,? extends CacheConfig> config) throws IOException
config - mapIOException - errorCopyright © 2014–2018 The Redisson Project. All rights reserved.