alibaba / alibaba/jetcache

jectcache错误百思不得姐

Open
#142 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

报错为:
2018-08-10 21:50:38,953-ERROR (com.alicp.jetcache.anno.support.CacheContext:90)- Cache operation aborted because can't find @Cached definition
com.alicp.jetcache.CacheConfigException: can't find @Cached definition with area=default name=getActivitySkus-, specified in public void com.xxx.xxx.service.activity.imp.CmsActivityServiceImpl.cancelGetActivitySkusCache(int)
at com.alicp.jetcache.anno.support.CacheContext.lambda$createCacheInvokeContext$1(CacheContext.java:89)
at com.alicp.jetcache.anno.method.CacheHandler.invokeWithInvalidateOrUpdate(CacheHandler.java:105)
at com.alicp.jetcache.anno.method.CacheHandler.doInvoke(CacheHandler.java:94)
at com.alicp.jetcache.anno.method.CacheHandler.invoke(CacheHandler.java:84)
at com.alicp.jetcache.anno.aop.JetCacheInterceptor.invoke(JetCacheInterceptor.java:67)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy64.cancelGetActivitySkusCache(Unknown Source)
at com.xxx.xxx.service.activity.imp.InvalidActivityCache.docleanActivityCache(InvalidActivityCache.java:42)
at com.xxx.xxx.service.activity.imp.InvalidActivityCache.cancelCache(InvalidActivityCache.java:30)
at com.xxx.xxx.service.activity.imp.InvalidActivityCache.cancelCache(InvalidActivityCache.java:15)
at com.xxx.xxx.listener.GoodsMsgListener.onApplicationEvent(GoodsMsgListener.java:59)
at com.xxx.xxx.listener.GoodsMsgListener$$FastClassBySpringCGLIB$$8b193165.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:745)
2018-08-10 21:50:39,091-ERROR (com.alicp.jetcache.anno.support.CacheContext:90)- Cache operation aborted because can't find @Cached definition
引入依赖:
版本号为: 2.4.4
缓存代码为:
@Override
@CacheInvalidate(name = "getActivitySkus-", key = "'activityId:'+#activityId")
public void cancelGetActivitySkusCache(int activityId) {
// nothing to do cleanCache
}
@Override
@Cached(name = "getActivitySkus-", key = "'activityId:'+#activityId")
public List getActivitySkus(int activityId) {
// to do something
return null;
}
@Cached的字母C为大写,但是issues这里显示出来为小写。
其中加缓存时缓存生效,redis中有值。失效缓存时,redis值被清除。也就是功能正常,但是一失效缓存时就报错,百思不得解,如果您有时间,请帮我解惑一下,谢谢

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at CacheContext.createCacheInvokeContext and CacheHandler.invokeWithInvalidateOrUpdate, then compare the @CacheInvalidate and @Cached methods shown in CmsActivityServiceImpl. Reproduce the invalidation call with JetCache 2.4.4 and trace annotation lookup; done means the reported discrepancy is explained and the error is either eliminated or documented with a verified workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.