Package org.redisson.spring.cache
Class RedissonSpringCacheManager
-
- org.redisson.spring.cache.RedissonSpringCacheManager
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.cache.CacheManager
,org.springframework.context.ResourceLoaderAware
public class RedissonSpringCacheManager extends implements org.springframework.cache.CacheManager, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.InitializingBean
ACacheManager
implementation backed by Redisson instance.- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description RedissonSpringCacheManager(RedissonClient redisson)
Creates CacheManager supplied by Redisson instanceRedissonSpringCacheManager(RedissonClient redisson, configLocation)
Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache name.RedissonSpringCacheManager(RedissonClient redisson, configLocation, Codec codec)
Creates CacheManager supplied by Redisson instance, Codec instance and Config location path.RedissonSpringCacheManager(RedissonClient redisson, <,? extends CacheConfig> config)
Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache nameRedissonSpringCacheManager(RedissonClient redisson, <,? extends CacheConfig> config, Codec codec)
Creates CacheManager supplied by Redisson instance, Codec instance and Cache config mapped by Cache name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
protected CacheConfig
createDefaultConfig()
org.springframework.cache.Cache
name)
<>
getCacheNames()
protected ,>
name, CacheConfig config)
protected ,>
name, CacheConfig config)
void
setAllowNullValues(boolean allowNullValues)
Defines possibility of storingnull
values.void
<> names)
Defines 'fixed' cache names.void
setCodec(Codec codec)
Set Codec instance shared between all Cache instancesvoid
<,? extends CacheConfig> config)
Set cache config mapped by cache namevoid
configLocation)
Set cache config locationvoid
setRedisson(RedissonClient redisson)
Set Redisson instancevoid
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
-
-
-
Constructor Detail
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson)
Creates CacheManager supplied by Redisson instance- Parameters:
redisson
- object
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson, <,? extends CacheConfig> config)
Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache name- Parameters:
redisson
- objectconfig
- object
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson, <,? extends CacheConfig> config, Codec codec)
Creates CacheManager supplied by Redisson instance, Codec instance and Cache config mapped by Cache name.Each Cache instance share one Codec instance.
- Parameters:
redisson
- objectconfig
- objectcodec
- object
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson, configLocation)
Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache name.Loads the config file from the class path, interpreting plain paths as class path resource names that include the package path (e.g. "mypackage/myresource.txt").
- Parameters:
redisson
- objectconfigLocation
- path
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson, configLocation, Codec codec)
Creates CacheManager supplied by Redisson instance, Codec instance and Config location path.Each Cache instance share one Codec instance.
Loads the config file from the class path, interpreting plain paths as class path resource names that include the package path (e.g. "mypackage/myresource.txt").
- Parameters:
redisson
- objectconfigLocation
- pathcodec
- object
-
-
Method Detail
-
setAllowNullValues
public void setAllowNullValues(boolean allowNullValues)
Defines possibility of storingnull
values.Default is
true
- Parameters:
allowNullValues
- - stores iftrue
-
setCacheNames
public void setCacheNames(<> names)
Defines 'fixed' cache names. A new cache instance will not be created in dynamic for non-defined names.`null` parameter setups dynamic mode
- Parameters:
names
- of caches
-
setConfigLocation
public void setConfigLocation( configLocation)
Set cache config location- Parameters:
configLocation
- object
-
setConfig
public void setConfig(<,? extends CacheConfig> config)
Set cache config mapped by cache name- Parameters:
config
- object
-
setRedisson
public void setRedisson(RedissonClient redisson)
Set Redisson instance- Parameters:
redisson
- instance
-
setCodec
public void setCodec(Codec codec)
Set Codec instance shared between all Cache instances- Parameters:
codec
- object
-
createDefaultConfig
protected CacheConfig createDefaultConfig()
-
getCache
public org.springframework.cache.Cache getCache( name)
- Specified by:
getCache
in interfaceorg.springframework.cache.CacheManager
-
getMap
protected ,> getMap( name, CacheConfig config)
-
getMapCache
protected ,> getMapCache( name, CacheConfig config)
-
getCacheNames
public <> getCacheNames()
- Specified by:
getCacheNames
in interfaceorg.springframework.cache.CacheManager
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- Specified by:
setResourceLoader
in interfaceorg.springframework.context.ResourceLoaderAware
-
afterPropertiesSet
public void afterPropertiesSet() throws
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
-
-