Package org.redisson.spring.cache
Class CacheConfig
-
- org.redisson.spring.cache.CacheConfig
-
public class CacheConfig extends
Cache config object used for Spring cache configuration.- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description CacheConfig()
Creates config object withttl = 0
andmaxIdleTime = 0
.CacheConfig(long ttl, long maxIdleTime)
Creates config object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <,? extends CacheConfig>
file)
Read config objects stored in JSON format fromFile
static <,? extends CacheConfig>
inputStream)
Read config objects stored in JSON format fromInputStream
static <,? extends CacheConfig>
reader)
Read config objects stored in JSON format fromReader
static <,? extends CacheConfig>
content)
Read config objects stored in JSON format fromString
static <,? extends CacheConfig>
url)
Read config objects stored in JSON format fromURL
static <,? extends CacheConfig>
file)
Read config objects stored in YAML format fromFile
static <,? extends CacheConfig>
inputStream)
Read config objects stored in YAML format fromInputStream
static <,? extends CacheConfig>
reader)
Read config objects stored in YAML format fromReader
static <,? extends CacheConfig>
content)
Read config objects stored in YAML format fromString
static <,? extends CacheConfig>
url)
Read config objects stored in YAML format fromURL
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
<,? extends CacheConfig> config)
Convert current configuration to JSON formatstatic
<,? extends CacheConfig> config)
Convert current configuration to YAML format
-
-
-
Constructor Detail
-
CacheConfig
public CacheConfig()
Creates config object withttl = 0
andmaxIdleTime = 0
.
-
CacheConfig
public CacheConfig(long ttl, long maxIdleTime)
Creates config object.- Parameters:
ttl
- - time to live for key\value entry in milliseconds. If0
then time to live doesn't affect entry expiration.maxIdleTime
- - max idle time for key\value entry in milliseconds.if
maxIdleTime
andttl
params are equal to0
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. If0
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 If0
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. If0
then max idle time doesn't affect entry expiration.
-
fromJSON
public static <,? extends content) throws
Read config objects stored in JSON format fromString
- Parameters:
content
- of config- Returns:
- config
- Throws:
- error
-
fromJSON
public static <,? extends inputStream) throws
Read config objects stored in JSON format fromInputStream
- Parameters:
inputStream
- of config- Returns:
- config
- Throws:
- error
-
fromJSON
public static <,? extends file) throws
Read config objects stored in JSON format fromFile
- Parameters:
file
- of config- Returns:
- config
- Throws:
- error
-
fromJSON
public static <,? extends url) throws
Read config objects stored in JSON format fromURL
- Parameters:
url
- of config- Returns:
- config
- Throws:
- error
-
fromJSON
public static <,? extends reader) throws
Read config objects stored in JSON format fromReader
- Parameters:
reader
- of config- Returns:
- config
- Throws:
- error
-
toJSON
public static toJSON(<,? extends CacheConfig> config) throws
Convert current configuration to JSON format- Parameters:
config
- object- Returns:
- json string
- Throws:
- error
-
fromYAML
public static <,? extends content) throws
Read config objects stored in YAML format fromString
- Parameters:
content
- of config- Returns:
- config
- Throws:
- error
-
fromYAML
public static <,? extends inputStream) throws
Read config objects stored in YAML format fromInputStream
- Parameters:
inputStream
- of config- Returns:
- config
- Throws:
- error
-
fromYAML
public static <,? extends file) throws
Read config objects stored in YAML format fromFile
- Parameters:
file
- of config- Returns:
- config
- Throws:
- error
-
fromYAML
public static <,? extends url) throws
Read config objects stored in YAML format fromURL
- Parameters:
url
- of config- Returns:
- config
- Throws:
- error
-
fromYAML
public static <,? extends reader) throws
Read config objects stored in YAML format fromReader
- Parameters:
reader
- of config- Returns:
- config
- Throws:
- error
-
toYAML
public static toYAML(<,? extends CacheConfig> config) throws
Convert current configuration to YAML format- Parameters:
config
- map- Returns:
- yaml string
- Throws:
- error
-
-