|
@@ -1,11 +1,9 @@
|
|
|
-package cn.iocoder.yudao.framework.captcha.core.service;
|
|
|
+package cn.iocoder.yudao.module.system.framework.captcha.core;
|
|
|
|
|
|
import com.xingyuv.captcha.service.CaptchaCacheService;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.NoArgsConstructor;
|
|
|
+import lombok.Setter;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
|
-import jakarta.annotation.Resource;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -13,11 +11,9 @@ import java.util.concurrent.TimeUnit;
|
|
|
*
|
|
|
* @author 星语
|
|
|
*/
|
|
|
-@NoArgsConstructor // 保证 aj-captcha 的 SPI 创建
|
|
|
-@AllArgsConstructor
|
|
|
+@Setter
|
|
|
public class RedisCaptchaServiceImpl implements CaptchaCacheService {
|
|
|
|
|
|
- @Resource // 保证 aj-captcha 的 SPI 创建时的注入
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
@Override
|
|
@@ -25,10 +21,6 @@ public class RedisCaptchaServiceImpl implements CaptchaCacheService {
|
|
|
return "redis";
|
|
|
}
|
|
|
|
|
|
- public void setStringRedisTemplate(StringRedisTemplate stringRedisTemplate) {
|
|
|
- this.stringRedisTemplate = stringRedisTemplate;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void set(String key, String value, long expiresInSeconds) {
|
|
|
stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
|