Commit a484cd5193956080bae8fbbca0ef8ea1e3f068c5
1 parent
b134492f
优化图片验证码的后端实现
Showing
1 changed file
with
28 additions
and
0 deletions
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.captcha.core.enums; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; | ||
| 4 | +import com.anji.captcha.model.vo.PointVO; | ||
| 5 | +import org.redisson.api.RLock; | ||
| 6 | + | ||
| 7 | +import java.time.Duration; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.HASH; | ||
| 11 | +import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 验证码 Redis Key 枚举类 | ||
| 15 | + * | ||
| 16 | + * @author 芋道源码 | ||
| 17 | + */ | ||
| 18 | +public interface CaptchaRedisKeyConstants { | ||
| 19 | + | ||
| 20 | + RedisKeyDefine AJ_CAPTCHA_REQ_LIMIT = new RedisKeyDefine("验证码的请求限流", | ||
| 21 | + "AJ.CAPTCHA.REQ.LIMIT-%s-%s", | ||
| 22 | + STRING, Integer.class, Duration.ofSeconds(60)); // 例如说:验证失败 5 次,get 接口锁定 | ||
| 23 | + | ||
| 24 | + RedisKeyDefine AJ_CAPTCHA_RUNNING = new RedisKeyDefine("验证码的坐标", | ||
| 25 | + "RUNNING:CAPTCHA:%s", // AbstractCaptchaService.REDIS_CAPTCHA_KEY | ||
| 26 | + STRING, PointVO.class, Duration.ofSeconds(120)); // {"secretKey":"PP1w2Frr2KEejD2m","x":162,"y":5} | ||
| 27 | + | ||
| 28 | +} |