public abstract class DefaultTTLRedisCache<V> extends Object implements ICache<String,V>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
| 限定符和类型 | 字段和说明 |
|---|---|
protected ITTLCacheProvider<V> |
cacheProvider
数据提供者
|
protected RedisCacheStorage<String,V> |
cacheStorage
数据存储器
|
protected int |
timeOut
超时时间,单位秒,默认10分钟
|
| 构造器和说明 |
|---|
DefaultTTLRedisCache() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
Map<String,V> |
get() |
V |
get(String key)
获取数据
如果返回null就是真的没有数据,无需再去数据库再取
|
protected String |
getKey(String key)
根据uuid和key生成key
|
void |
invalid() |
void |
invalid(String key)
失效数据
|
void |
invalidMulti(String... keys) |
void |
setCacheProvider(ITTLCacheProvider<V> cacheProvider)
设置数据提供者
|
void |
setCacheStorage(RedisCacheStorage<String,V> cacheStorage)
设置数据存储者
|
void |
setTimeOut(int seconds)
设置超时时间
|
protected ITTLCacheProvider<V> cacheProvider
protected RedisCacheStorage<String,V> cacheStorage
protected int timeOut
public void setCacheProvider(ITTLCacheProvider<V> cacheProvider)
cacheProvider - cacheProviderpublic void setCacheStorage(RedisCacheStorage<String,V> cacheStorage)
cacheStorage - cacheStoragepublic void setTimeOut(int seconds)
seconds - secondspublic void invalidMulti(String... keys)
invalidMulti 在接口中 ICache<String,V>public void destroy()
throws Exception
destroy 在接口中 org.springframework.beans.factory.DisposableBeanExceptionCopyright © 2018 Pivotal Software, Inc.. All rights reserved.