public class RedisCacheWrapper extends Object implements ICache
DEFAULT, MULTILEVEL, REDIS| Constructor and Description |
|---|
RedisCacheWrapper(ICaches owner,
IRedis redis,
String cacheName,
ICacheEventListener cacheEventListener) |
| Modifier and Type | Method and Description |
|---|---|
ICacheLocker |
acquireCacheLocker()
获取缓存锁对象,若缓存实例不支持则返回null
|
void |
clear()
清理缓存
|
void |
close() |
Object |
get(Object key)
从缓存中获取对象
|
List<String> |
keys()
获取当前所有缓存对象key的集合
|
void |
put(Object key,
Object value)
添加对象到缓存
|
void |
put(Object key,
Object value,
int timeout)
添加对象到缓存
|
void |
remove(Object key)
从缓存中移除对象
|
void |
removeAll(Collection<?> keys)
批量从缓存中移除对象
|
void |
update(Object key,
Object value)
更新对象到缓存
|
void |
update(Object key,
Object value,
int timeout)
更新对象到缓存
|
public RedisCacheWrapper(ICaches owner, IRedis redis, String cacheName, ICacheEventListener cacheEventListener)
public Object get(Object key) throws CacheException
ICacheget in interface ICachekey - 缓存keyCacheException - 可能产生的异常public void put(Object key, Object value) throws CacheException
ICacheput in interface ICachekey - 缓存keyvalue - 预缓存的元素对象CacheException - 可能产生的异常public void put(Object key, Object value, int timeout) throws CacheException
ICacheput in interface ICachekey - 缓存keyvalue - 预缓存的元素对象timeout - 自定义超时时间(秒),若为0则使用默认值CacheException - 可能产生的异常public void update(Object key, Object value) throws CacheException
ICacheupdate in interface ICachekey - 缓存keyvalue - 预缓存的元素对象CacheException - 可能产生的异常public void update(Object key, Object value, int timeout) throws CacheException
ICacheupdate in interface ICachekey - 缓存keyvalue - 预缓存的元素对象timeout - 自定义超时时间(秒),若为0则使用默认值CacheException - 可能产生的异常public List<String> keys() throws CacheException
ICachekeys in interface ICacheCacheException - 可能产生的异常public void remove(Object key) throws CacheException
ICacheremove in interface ICachekey - 缓存keyCacheException - 可能产生的异常public void removeAll(Collection<?> keys) throws CacheException
ICacheremoveAll in interface ICachekeys - 缓存key集合CacheException - 可能产生的异常public void clear()
throws CacheException
ICacheclear in interface ICacheCacheException - 可能产生的异常public void close()
throws Exception
close in interface AutoCloseableExceptionpublic ICacheLocker acquireCacheLocker()
ICacheacquireCacheLocker in interface ICacheCopyright © 2022. All rights reserved.