public class SimpleCacheInterceptor extends Object implements Interceptor
| 限定符和类型 | 类和说明 |
|---|---|
class |
SimpleCacheInterceptor.CacheKey |
static interface |
SimpleCacheInterceptor.CacheManager |
static class |
SimpleCacheInterceptor.MapCacheManager |
| 构造器和说明 |
|---|
SimpleCacheInterceptor(List<String> namespaces)
用MapCacheManager来实现缓存
|
SimpleCacheInterceptor(List<String> namespaces,
SimpleCacheInterceptor.CacheManager cm) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
after(InterceptorContext ctx)
如果正常执行,调用after
|
void |
before(InterceptorContext ctx)
在查询前执行
|
protected boolean |
cacheRequire(String ns) |
void |
clearCache(String ns)
清除缓存对象
|
boolean |
containCache(String ns,
Object key) |
void |
exception(InterceptorContext ctx,
Exception ex)
如果异常,将调用exception
|
Object |
getCacheKey(InterceptorContext ctx)
Gets the cache key.
|
protected Object |
getCacheKey(SqlId sqlId,
List<SQLParameter> paras) |
SimpleCacheInterceptor.CacheManager |
getCacheManger() |
Object |
getCacheObject(String ns,
Object cacheKey)
获取缓存对象
|
Set<String> |
getNsSet() |
void |
putCache(String ns,
Object key,
InterceptorContext ctx)
设置缓存对象
|
public SimpleCacheInterceptor(List<String> namespaces)
namespaces - 需要考虑缓存的实体public SimpleCacheInterceptor(List<String> namespaces, SimpleCacheInterceptor.CacheManager cm)
namespaces - cm - 指定的缓存管理public void before(InterceptorContext ctx)
Interceptorbefore 在接口中 Interceptorpublic void after(InterceptorContext ctx)
Interceptorafter 在接口中 Interceptorpublic Object getCacheKey(InterceptorContext ctx)
ctx - the ctxprotected Object getCacheKey(SqlId sqlId, List<SQLParameter> paras)
public Object getCacheObject(String ns, Object cacheKey)
ns - cacheKey - public void clearCache(String ns)
ns - public void putCache(String ns, Object key, InterceptorContext ctx)
ns - key - ctx - protected boolean cacheRequire(String ns)
public SimpleCacheInterceptor.CacheManager getCacheManger()
public void exception(InterceptorContext ctx, Exception ex)
Interceptorexception 在接口中 InterceptorCopyright © 2021. All rights reserved.