Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java后端代码中Redis缓存中验证错误次数似乎存储了字符串类型导致incr失败 #175

Open
jiuxiajingfan opened this issue Jul 25, 2023 · 1 comment

Comments

@jiuxiajingfan
Copy link

使用版本:

com.anji-plus
spring-boot-starter-captcha
1.3.0

在AbstractCaptchaService类中的如下方法:
protected void afterValidateFail(CaptchaVO data) {
if (limitHandler != null) {
// 验证失败 分钟内计数
String fails = String.format(FrequencyLimitHandler.LIMIT_KEY, "FAIL", data.getClientUid());
CaptchaCacheService cs = getCacheService(cacheType);
if (!cs.exists(fails)) {
cs.set(fails, "1", 60);
}
cs.increment(fails, 1);
}
}
incr会爆出ERR wrong number of arguments for 'incr' command错误

@LanSimon
Copy link

LanSimon commented Apr 3, 2024

遇到了同样问题,临时解决方案是重写了set方法的逻辑,判断如果字符串是数字的话,存入redis时将字符串转为数字类型

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants