alibaba / alibaba/jetcache

JetCache+Shiro缓存不生效

Open
#586 0 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

项目使用Shiro,在继承Shiro的SimpleCredentialsMatcher类的子类中,调用带有@Cached的方法,缓存是不生效的。
public class SysCredentialsMatcher extends SimpleCredentialsMatcher {

@Resource
private ISysPasswordTypeService iSysPasswordTypeService;

@Override
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
//该方法使用注解@Cached,但是缓存不生效
SysPasswordType passwordType = iSysPasswordTypeService.getPasswordTypeByType(userPassword.getPwdType());
}
}

同样的方法,在其他的服务中调用是能够成功将数据缓存到redis中

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at SysCredentialsMatcher.doCredentialsMatch and the iSysPasswordTypeService.getPasswordTypeByType call shown in the issue. Compare this invocation with the other service calls that cache successfully, then inspect how @Cached interception applies to the Shiro matcher context. Done means the password-type lookup is stored and retrieved from Redis when called there.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.