Package org.redisson.spring.cache
Class RedissonSpringCacheManager
java.lang.Object
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
- Direct Known Subclasses:
RedissonSpringCacheNativeManager
public class RedissonSpringCacheManager
extends Object
implements org.springframework.cache.CacheManager, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.InitializingBean
A
CacheManager
implementation
backed by Redisson instance.- Author:
- Nikita Koksharov
-
Constructor Summary
ConstructorDescriptionRedissonSpringCacheManager
(RedissonClient redisson) Creates CacheManager supplied by Redisson instanceRedissonSpringCacheManager
(RedissonClient redisson, String configLocation) Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache name.RedissonSpringCacheManager
(RedissonClient redisson, String configLocation, Codec codec) Creates CacheManager supplied by Redisson instance, Codec instance and Config location path.RedissonSpringCacheManager
(RedissonClient redisson, Map<String, ? extends CacheConfig> config) Creates CacheManager supplied by Redisson instance and Cache config mapped by Cache nameRedissonSpringCacheManager
(RedissonClient redisson, Map<String, ? extends CacheConfig> config, Codec codec) Creates CacheManager supplied by Redisson instance, Codec instance and Cache config mapped by Cache name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected CacheConfig
org.springframework.cache.Cache
getMap
(String name, CacheConfig config) getMapCache
(String name, CacheConfig config) void
setAllowNullValues
(boolean allowNullValues) Defines possibility of storingnull
values.void
setCacheNames
(Collection<String> names) Defines 'fixed' cache names.void
Set Codec instance shared between all Cache instancesvoid
setConfig
(Map<String, ? extends CacheConfig> config) Set cache config mapped by cache namevoid
setConfigLocation
(String configLocation) Set cache config locationvoid
setRedisson
(RedissonClient redisson) Set Redisson instancevoid
setResourceLoader
(org.springframework.core.io.ResourceLoader resourceLoader) void
setTransactionAware
(boolean transactionAware) Defines if cache aware of Spring-managed transactions.
-
Constructor Details
-
RedissonSpringCacheManager
Creates CacheManager supplied by Redisson instance- Parameters:
redisson
- object
-
RedissonSpringCacheManager
public RedissonSpringCacheManager(RedissonClient redisson, Map<String, ? 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, Map<String, ? 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
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
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 Details
-
setAllowNullValues
public void setAllowNullValues(boolean allowNullValues) Defines possibility of storingnull
values.Default is
true
- Parameters:
allowNullValues
- stores iftrue
-
setTransactionAware
public void setTransactionAware(boolean transactionAware) Defines if cache aware of Spring-managed transactions. Iftrue
put/evict operations are executed only for successful transaction in after-commit phase.Default is
false
- Parameters:
transactionAware
- cache is transaction aware iftrue
-
setCacheNames
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
Set cache config location- Parameters:
configLocation
- object
-
setConfig
Set cache config mapped by cache name- Parameters:
config
- object
-
setRedisson
Set Redisson instance- Parameters:
redisson
- instance
-
setCodec
Set Codec instance shared between all Cache instances- Parameters:
codec
- object
-
createDefaultConfig
-
getCache
- Specified by:
getCache
in interfaceorg.springframework.cache.CacheManager
-
getMap
-
getMapCache
-
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
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-