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
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
ConstructorsConstructorDescriptionRedissonSpringCacheManager(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 TypeMethodDescriptionvoidprotected CacheConfigorg.springframework.cache.CachegetMap(String name, CacheConfig config) getMapCache(String name, CacheConfig config) voidsetAllowNullValues(boolean allowNullValues) Defines possibility of storingnullvalues.voidsetCacheNames(Collection<String> names) Defines 'fixed' cache names.voidSet Codec instance shared between all Cache instancesvoidsetConfig(Map<String, ? extends CacheConfig> config) Set cache config mapped by cache namevoidsetConfigLocation(String configLocation) Set cache config locationvoidsetRedisson(RedissonClient redisson) Set Redisson instancevoidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) voidsetTransactionAware(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 storingnullvalues.Default is
true- Parameters:
allowNullValues- stores iftrue
-
setTransactionAware
public void setTransactionAware(boolean transactionAware) Defines if cache aware of Spring-managed transactions. Iftrueput/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:
getCachein interfaceorg.springframework.cache.CacheManager
-
getMap
-
getMapCache
-
getCacheNames
- Specified by:
getCacheNamesin interfaceorg.springframework.cache.CacheManager
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoaderin interfaceorg.springframework.context.ResourceLoaderAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-