使用分布式缓存,取数据时key计算有错误
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
@Cached(name = "cache:", key = "#keyVal", cacheType = CacheType.REMOTE, expire = 60 * 60)
public ExpressCacheInfo getCacheInfoByAssignedKeyVal(String keyName, Object keyVal, ExpressCatalog expressCatalog) {}
上面是我的方法加了注解缓存, 测试的时候发现虽然缓存已经有数据了,但是每次请求都打到底层数据库请求, 跟踪了下代码发现:
Object key = ExpressionUtil.evalKey(context, cic.getCachedAnnoConfig()); 这个表达并没有把name作为前缀拼接上key,导致查询缓存失败。
这个是bug 吗?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at ExpressionUtil.evalKey(context, cic.getCachedAnnoConfig()) and trace how the Cached annotation's name and key are constructed for remote caching. Reproduce the reported getCacheInfoByAssignedKeyVal case, then verify that an existing distributed-cache entry is found instead of querying the underlying database.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100