本文整理汇总了Java中com.jarvis.cache.annotation.CacheDelete类的典型用法代码示例。如果您正苦于以下问题:Java CacheDelete类的具体用法?Java CacheDelete怎么用?Java CacheDelete使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CacheDelete类属于com.jarvis.cache.annotation包,在下文中一共展示了CacheDelete类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
/**
* 删除对象,并删除其缓存,再删除以及对象集合变更后,失效的查询缓存
*/
@CacheDelete({//
@CacheDeleteKey(value = KEY_USER, hfield = "#args[0]", condition = "null != #args[0]"), //
@CacheDeleteKey(value = KEY_USER_FIND) //
})
public void delete(Long id) {
userData.delete(id);
}
示例2: DelCacheAopInterceptor
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
public DelCacheAopInterceptor(AbstractCacheManager cacheManager, CacheDelete cache, Method method) {
this.cacheManager=cacheManager;
this.cache=cache;
if(method.isAnnotationPresent(CacheDelete.class)) {
this.haveCache=true;
}
}
示例3: deleteCache
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
/**
* 处理@CacheDelete 拦截
* @param jp 切点
* @param cacheDelete 拦截到的注解
* @param retVal 返回值
*/
public void deleteCache(DeleteCacheAopProxyChain jp, CacheDelete cacheDelete, Object retVal) throws Throwable {
Object[] arguments=jp.getArgs();
CacheDeleteKey[] keys=cacheDelete.value();
if(null == keys || keys.length == 0) {
return;
}
Object target=jp.getTarget();
String methodName=jp.getMethod().getName();
try {
for(int i=0; i < keys.length; i++) {
CacheDeleteKey keyConfig=keys[i];
String[] tempKeys=keyConfig.value();
String tempHfield=keyConfig.hfield();
if(!scriptParser.isCanDelete(keyConfig, arguments, retVal)) {
continue;
}
for(String tempKey: tempKeys) {
CacheKeyTO key=getCacheKey(target, methodName, arguments, tempKey, tempHfield, retVal, true);
if(null != key && !CacheHelper.addDeleteCacheKey(key)) {
this.delete(key);
this.getAutoLoadHandler().resetAutoLoadLastLoadTime(key);
}
}
}
} catch(Throwable e) {
log.error(e.getMessage(), e);
throw e;
}
}
示例4: checkAndDeleteCache
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
public void checkAndDeleteCache(JoinPoint jp, Object retVal) throws Throwable {
Signature signature=jp.getSignature();
MethodSignature methodSignature=(MethodSignature)signature;
Method method=methodSignature.getMethod();
if(method.isAnnotationPresent(CacheDelete.class)) {
CacheDelete cacheDelete=method.getAnnotation(CacheDelete.class);
this.deleteCache(jp, cacheDelete, retVal);
}
}
示例5: create
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
/**
* 创建对象后并缓存,再删除因对象集合变更后,失效的查询缓存
*/
@Cache(key = KEY_USER, hfield = "#retVal.id", expire = EXPIRE, opType = CacheOpType.WRITE)
@CacheDelete({ @CacheDeleteKey(value = KEY_USER_FIND) })
public User create() {
return userData.create();
}
示例6: makeIt
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
public List<? extends MethodInterceptor> makeIt(CacheDelete cache, Method method, Ioc ioc) {
return Arrays.asList(new DelCacheAopInterceptor(ioc.get(AbstractCacheManager.class, "cachePointCut"), cache, method));
}
示例7: deleteCache
import com.jarvis.cache.annotation.CacheDelete; //导入依赖的package包/类
public void deleteCache(JoinPoint aopProxyChain, CacheDelete cacheDelete, Object retVal) throws Throwable {
cacheHandler.deleteCache(new AspectjDeleteCacheAopProxyChain(aopProxyChain), cacheDelete, retVal);
}