Package org.javalite.activejdbc.cache
Class RedisCacheManager
- java.lang.Object
-
- org.javalite.activejdbc.cache.CacheManager
-
- org.javalite.activejdbc.cache.RedisCacheManager
-
public class RedisCacheManager extends CacheManager
Redis cache manager. Will store caches in Redis server. By default will connect to Redis running on local host.If redis server is located elsewhere, provide property files for different environments according to
AppConfigrules. See: AppConfig for more information. The environment-specific properties files have to have the following properties for this class to function:-
redis.cache.manager.host -
redis.cache.manager.port
localhostand default port for Redis.Limitation: Does not support
CacheManager.flush(CacheEvent)with value 'ALL'.- Author:
- Igor Polevoy on 12/7/15.
-
-
-
Constructor Summary
Constructors Constructor Description RedisCacheManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCache(String group, String key, Object cache)Adds item to cache.voiddoFlush(CacheEvent event)ObjectgetCache(String group, String key)Returns a cached item.ObjectgetImplementation()Returns underlying instance of implementation for specific configuration.-
Methods inherited from class org.javalite.activejdbc.cache.CacheManager
addCacheEventListener, flush, flush, getKey, purgeTableCache, purgeTableCache, removeAllCacheEventListeners, removeCacheEventListener
-
-
-
-
Method Detail
-
getCache
public Object getCache(String group, String key)
Description copied from class:CacheManagerReturns a cached item. Can return null if not found.- Specified by:
getCachein classCacheManager- Parameters:
group- group of caches - this is a name of a table for which query results are cachedkey- key of the item.- Returns:
- a cached item. Can return null if not found.
-
addCache
public void addCache(String group, String key, Object cache)
Description copied from class:CacheManagerAdds item to cache.- Specified by:
addCachein classCacheManager- Parameters:
group- group name of cache.key- key of the item.cache- cache item to add to cache.
-
doFlush
public void doFlush(CacheEvent event)
- Specified by:
doFlushin classCacheManager
-
getImplementation
public Object getImplementation()
Description copied from class:CacheManagerReturns underlying instance of implementation for specific configuration.- Specified by:
getImplementationin classCacheManager- Returns:
- actual underlying implementation of cache. The same as configured in
activejdbc.propertiesfile. For instance:redis.clients.jedis.JedisPool.
-
-