mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-13 02:57:13 +08:00
refactor: 移除 Spring Cache,初步适配 JetCache
1.移除 ContiNew Starter Spring Cache 2.初步适配 ContiNew Starter JetCache 3.优化缓存键前缀常量的使用
This commit is contained in:
@@ -19,6 +19,7 @@ package top.charles7c.continew.admin;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -28,7 +29,6 @@ import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties;
|
||||
@@ -42,11 +42,11 @@ import java.net.InetAddress;
|
||||
* @since 2022/12/8 23:15
|
||||
*/
|
||||
@Slf4j
|
||||
@EnableCaching
|
||||
@EnableFileStorage
|
||||
@RestController
|
||||
@EnableFileStorage
|
||||
@SpringBootApplication
|
||||
@RequiredArgsConstructor
|
||||
@EnableMethodCache(basePackages = "top.charles7c.continew.admin")
|
||||
public class ContiNewAdminApplication implements ApplicationRunner {
|
||||
|
||||
private final ProjectProperties projectProperties;
|
||||
|
@@ -67,7 +67,7 @@ public class AuthController {
|
||||
@Operation(summary = "账号登录", description = "根据账号和密码进行登录认证")
|
||||
@PostMapping("/account")
|
||||
public R<LoginResp> accountLogin(@Validated @RequestBody AccountLoginReq loginReq) {
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, loginReq.getUuid());
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + loginReq.getUuid();
|
||||
String captcha = RedisUtils.get(captchaKey);
|
||||
ValidationUtils.throwIfBlank(captcha, "验证码已失效");
|
||||
RedisUtils.delete(captchaKey);
|
||||
@@ -84,7 +84,7 @@ public class AuthController {
|
||||
@PostMapping("/email")
|
||||
public R<LoginResp> emailLogin(@Validated @RequestBody EmailLoginReq loginReq) {
|
||||
String email = loginReq.getEmail();
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, email);
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + email;
|
||||
String captcha = RedisUtils.get(captchaKey);
|
||||
ValidationUtils.throwIfBlank(captcha, "验证码已失效");
|
||||
ValidationUtils.throwIfNotEqualIgnoreCase(loginReq.getCaptcha(), captcha, "验证码错误");
|
||||
@@ -98,7 +98,7 @@ public class AuthController {
|
||||
@PostMapping("/phone")
|
||||
public R<LoginResp> phoneLogin(@Validated @RequestBody PhoneLoginReq loginReq) {
|
||||
String phone = loginReq.getPhone();
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, phone);
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + phone;
|
||||
String captcha = RedisUtils.get(captchaKey);
|
||||
ValidationUtils.throwIfBlank(captcha, "验证码已失效");
|
||||
ValidationUtils.throwIfNotEqualIgnoreCase(loginReq.getCaptcha(), captcha, "验证码错误");
|
||||
|
@@ -16,20 +16,24 @@
|
||||
|
||||
package top.charles7c.continew.admin.webapi.common;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
import com.anji.captcha.model.common.RepCodeEnum;
|
||||
import com.anji.captcha.model.common.ResponseModel;
|
||||
import com.anji.captcha.model.vo.CaptchaVO;
|
||||
import com.anji.captcha.service.CaptchaService;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.comm.constant.SupplierConstant;
|
||||
@@ -38,20 +42,6 @@ import org.redisson.api.RateType;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.anji.captcha.model.common.RepCodeEnum;
|
||||
import com.anji.captcha.model.common.ResponseModel;
|
||||
import com.anji.captcha.model.vo.CaptchaVO;
|
||||
import com.anji.captcha.service.CaptchaService;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
|
||||
import top.charles7c.continew.admin.common.config.properties.CaptchaProperties;
|
||||
import top.charles7c.continew.admin.common.constant.CacheConstants;
|
||||
import top.charles7c.continew.admin.common.constant.RegexConstants;
|
||||
@@ -66,6 +56,10 @@ import top.charles7c.continew.starter.extension.crud.model.resp.R;
|
||||
import top.charles7c.continew.starter.log.common.annotation.Log;
|
||||
import top.charles7c.continew.starter.messaging.mail.util.MailUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 验证码 API
|
||||
*
|
||||
@@ -106,7 +100,7 @@ public class CaptchaController {
|
||||
public R<CaptchaResp> getImageCaptcha() {
|
||||
Captcha captcha = graphicCaptchaProperties.getCaptcha();
|
||||
String uuid = IdUtil.fastUUID();
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, uuid);
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + uuid;
|
||||
RedisUtils.set(captchaKey, captcha.text(), Duration.ofMinutes(captchaProperties.getExpirationInMinutes()));
|
||||
return R.ok(CaptchaResp.builder().uuid(uuid).img(captcha.toBase64()).build());
|
||||
}
|
||||
@@ -116,7 +110,7 @@ public class CaptchaController {
|
||||
public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexConstants.EMAIL, message = "邮箱格式错误") String email) throws MessagingException {
|
||||
String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX;
|
||||
String captchaKeyPrefix = CacheConstants.CAPTCHA_KEY_PREFIX;
|
||||
String limitCaptchaKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, email);
|
||||
String limitCaptchaKey = limitKeyPrefix + captchaKeyPrefix + email;
|
||||
long limitTimeInMillisecond = RedisUtils.getTimeToLive(limitCaptchaKey);
|
||||
CheckUtils.throwIf(limitTimeInMillisecond > 0, "发送验证码过于频繁,请您 {}s 后再试", limitTimeInMillisecond / 1000);
|
||||
// 生成验证码
|
||||
@@ -129,7 +123,7 @@ public class CaptchaController {
|
||||
.set("expiration", expirationInMinutes));
|
||||
MailUtils.sendHtml(email, String.format("【%s】邮箱验证码", projectProperties.getName()), content);
|
||||
// 保存验证码
|
||||
String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, email);
|
||||
String captchaKey = captchaKeyPrefix + email;
|
||||
RedisUtils.set(captchaKey, captcha, Duration.ofMinutes(expirationInMinutes));
|
||||
RedisUtils.set(limitCaptchaKey, captcha, Duration.ofSeconds(captchaMail.getLimitInSeconds()));
|
||||
return R.ok(String.format("发送成功,验证码有效期 %s 分钟", expirationInMinutes));
|
||||
@@ -148,21 +142,21 @@ public class CaptchaController {
|
||||
String templateId = captchaSms.getTemplateId();
|
||||
String limitKeyPrefix = CacheConstants.LIMIT_KEY_PREFIX;
|
||||
String captchaKeyPrefix = CacheConstants.CAPTCHA_KEY_PREFIX;
|
||||
String limitTemplateKeyPrefix = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix);
|
||||
String limitTemplateKeyPrefix = limitKeyPrefix + captchaKeyPrefix;
|
||||
// 限制短信发送频率
|
||||
// 1.同一号码同一短信模板,1分钟2条,1小时8条,24小时20条,e.g. LIMIT:CAPTCHA:XXX:188xxxxx:1
|
||||
CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils
|
||||
.formatKey(limitTemplateKeyPrefix, "MIN", phone, templateId), RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试");
|
||||
.formatKey(limitTemplateKeyPrefix + "MIN", phone, templateId), RateType.OVERALL, 2, 60), "验证码发送过于频繁,请稍后后再试");
|
||||
CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils
|
||||
.formatKey(limitTemplateKeyPrefix, "HOUR", phone, templateId), RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试");
|
||||
.formatKey(limitTemplateKeyPrefix + "HOUR", phone, templateId), RateType.OVERALL, 8, 60 * 60), "验证码发送过于频繁,请稍后后再试");
|
||||
CheckUtils.throwIf(!RedisUtils.rateLimit(RedisUtils
|
||||
.formatKey(limitTemplateKeyPrefix, "DAY", phone, templateId), RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试");
|
||||
.formatKey(limitTemplateKeyPrefix + "DAY", phone, templateId), RateType.OVERALL, 20, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试");
|
||||
// 2.同一号码所有短信模板 24 小时 100 条,e.g. LIMIT:CAPTCHA:188xxxxx
|
||||
String limitPhoneKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, phone);
|
||||
String limitPhoneKey = limitKeyPrefix + captchaKeyPrefix + phone;
|
||||
CheckUtils.throwIf(!RedisUtils
|
||||
.rateLimit(limitPhoneKey, RateType.OVERALL, 100, 60 * 60 * 24), "验证码发送过于频繁,请稍后后再试");
|
||||
// 3.同一 IP 每分钟限制发送 30 条,e.g. LIMIT:CAPTCHA:PHONE:1xx.1xx.1xx.1xx
|
||||
String limitIpKey = RedisUtils.formatKey(limitKeyPrefix, captchaKeyPrefix, "PHONE", JakartaServletUtil
|
||||
String limitIpKey = RedisUtils.formatKey(limitKeyPrefix + captchaKeyPrefix + "PHONE", JakartaServletUtil
|
||||
.getClientIP(request));
|
||||
CheckUtils.throwIf(!RedisUtils.rateLimit(limitIpKey, RateType.OVERALL, 30, 60), "验证码发送过于频繁,请稍后后再试");
|
||||
// 生成验证码
|
||||
@@ -177,7 +171,7 @@ public class CaptchaController {
|
||||
.getTemplateId(), (LinkedHashMap<String, String>)messageMap);
|
||||
CheckUtils.throwIf(!smsResponse.isSuccess(), "验证码发送失败");
|
||||
// 保存验证码
|
||||
String captchaKey = RedisUtils.formatKey(captchaKeyPrefix, phone);
|
||||
String captchaKey = captchaKeyPrefix + phone;
|
||||
RedisUtils.set(captchaKey, captcha, Duration.ofMinutes(expirationInMinutes));
|
||||
return R.ok(String.format("发送成功,验证码有效期 %s 分钟", expirationInMinutes));
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alicp.jetcache.anno.Cached;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
@@ -27,7 +28,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.x.file.storage.core.FileInfo;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -103,7 +103,7 @@ public class CommonController {
|
||||
@Operation(summary = "查询字典", description = "查询字典列表")
|
||||
@Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH)
|
||||
@GetMapping("/dict/{code}")
|
||||
@Cacheable(key = "#code", cacheNames = CacheConstants.DICT_KEY_PREFIX)
|
||||
@Cached(key = "#code", name = CacheConstants.DICT_KEY_PREFIX)
|
||||
public R<List<LabelValueResp>> listDict(@PathVariable String code) {
|
||||
Optional<Class<?>> enumClass = this.getEnumClassByName(code);
|
||||
return R.ok(enumClass.map(this::listEnumDict).orElseGet(() -> dictItemService.listByDictCode(code)));
|
||||
@@ -112,7 +112,7 @@ public class CommonController {
|
||||
@SaIgnore
|
||||
@Operation(summary = "查询参数", description = "查询参数")
|
||||
@GetMapping("/option")
|
||||
@Cacheable(cacheNames = CacheConstants.OPTION_KEY_PREFIX)
|
||||
@Cached(name = CacheConstants.OPTION_KEY_PREFIX)
|
||||
public R<List<LabelValueResp>> listOption(@Validated OptionQuery query) {
|
||||
return R.ok(optionService.list(query)
|
||||
.stream()
|
||||
|
@@ -113,7 +113,7 @@ public class UserCenterController {
|
||||
String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq
|
||||
.getCurrentPassword()));
|
||||
ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败");
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewPhone());
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + updateReq.getNewPhone();
|
||||
String captcha = RedisUtils.get(captchaKey);
|
||||
ValidationUtils.throwIfBlank(captcha, "验证码已失效");
|
||||
ValidationUtils.throwIfNotEqualIgnoreCase(updateReq.getCaptcha(), captcha, "验证码错误");
|
||||
@@ -128,7 +128,7 @@ public class UserCenterController {
|
||||
String rawCurrentPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq
|
||||
.getCurrentPassword()));
|
||||
ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败");
|
||||
String captchaKey = RedisUtils.formatKey(CacheConstants.CAPTCHA_KEY_PREFIX, updateReq.getNewEmail());
|
||||
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + updateReq.getNewEmail();
|
||||
String captcha = RedisUtils.get(captchaKey);
|
||||
ValidationUtils.throwIfBlank(captcha, "验证码已失效");
|
||||
ValidationUtils.throwIfNotEqualIgnoreCase(updateReq.getCaptcha(), captcha, "验证码错误");
|
||||
|
@@ -56,30 +56,54 @@ spring.liquibase:
|
||||
change-log: classpath:/db/changelog/db.changelog-master.yaml
|
||||
|
||||
--- ### 缓存配置
|
||||
spring:
|
||||
## Spring Cache 配置
|
||||
cache:
|
||||
type: REDIS
|
||||
data:
|
||||
## Redis 配置(单机版)
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl:
|
||||
enabled: false
|
||||
# Redisson 配置
|
||||
redisson:
|
||||
enabled: true
|
||||
mode: SINGLE
|
||||
spring.data:
|
||||
## Redis 配置(单机模式)
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl:
|
||||
enabled: false
|
||||
## Redisson 配置
|
||||
redisson:
|
||||
enabled: true
|
||||
mode: SINGLE
|
||||
## JetCache 配置
|
||||
jetcache:
|
||||
## 本地/进程级/一级缓存配置
|
||||
local:
|
||||
default:
|
||||
# 缓存类型
|
||||
type: caffeine
|
||||
# key 转换器的全局配置
|
||||
keyConvertor: jackson
|
||||
# 以毫秒为单位指定超时时间的全局配置
|
||||
expireAfterWriteInMillis: 7200000
|
||||
# 每个缓存实例的最大元素的全局配置,仅 local 类型的缓存需要指定
|
||||
limit: 1000
|
||||
## 远程/分布式/二级缓存配置
|
||||
remote:
|
||||
default:
|
||||
# 缓存类型
|
||||
type: redisson
|
||||
# key 转换器的全局配置(用于将复杂的 KEY 类型转换为缓存实现可以接受的类型)
|
||||
keyConvertor: jackson
|
||||
# 以毫秒为单位指定超时时间的全局配置
|
||||
expireAfterWriteInMillis: 7200000
|
||||
# 2.7+ 支持两级缓存更新以后失效其他 JVM 中的 local cache,但多个服务共用 Redis 同一个 channel 可能会造成广播风暴,需要在这里指定channel。
|
||||
# 你可以决定多个不同的服务是否共用同一个 channel,如果没有指定则不开启。
|
||||
broadcastChannel: ${spring.application.name}
|
||||
# 序列化器的全局配置,仅 remote 类型的缓存需要指定
|
||||
valueEncoder: java
|
||||
valueDecoder: java
|
||||
|
||||
--- ### 验证码配置
|
||||
continew-starter.captcha:
|
||||
|
@@ -58,30 +58,54 @@ spring.liquibase:
|
||||
change-log: classpath:/db/changelog/db.changelog-master.yaml
|
||||
|
||||
--- ### 缓存配置
|
||||
spring:
|
||||
## Spring Cache 配置
|
||||
cache:
|
||||
type: REDIS
|
||||
data:
|
||||
## Redis 配置(单机版)
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl:
|
||||
enabled: false
|
||||
# Redisson 配置
|
||||
redisson:
|
||||
enabled: true
|
||||
mode: SINGLE
|
||||
spring.data:
|
||||
## Redis 配置(单机模式)
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl:
|
||||
enabled: false
|
||||
## Redisson 配置
|
||||
redisson:
|
||||
enabled: true
|
||||
mode: SINGLE
|
||||
## JetCache 配置
|
||||
jetcache:
|
||||
## 本地/进程级/一级缓存配置
|
||||
local:
|
||||
default:
|
||||
# 缓存类型
|
||||
type: caffeine
|
||||
# key 转换器的全局配置
|
||||
keyConvertor: jackson
|
||||
# 以毫秒为单位指定超时时间的全局配置
|
||||
expireAfterWriteInMillis: 7200000
|
||||
# 每个缓存实例的最大元素的全局配置,仅 local 类型的缓存需要指定
|
||||
limit: 1000
|
||||
## 远程/分布式/二级缓存配置
|
||||
remote:
|
||||
default:
|
||||
# 缓存类型
|
||||
type: redisson
|
||||
# key 转换器的全局配置(用于将复杂的 KEY 类型转换为缓存实现可以接受的类型)
|
||||
keyConvertor: jackson
|
||||
# 以毫秒为单位指定超时时间的全局配置
|
||||
expireAfterWriteInMillis: 7200000
|
||||
# 2.7+ 支持两级缓存更新以后失效其他 JVM 中的 local cache,但多个服务共用 Redis 同一个 channel 可能会造成广播风暴,需要在这里指定channel。
|
||||
# 你可以决定多个不同的服务是否共用同一个 channel,如果没有指定则不开启。
|
||||
broadcastChannel: ${spring.application.name}
|
||||
# 序列化器的全局配置,仅 remote 类型的缓存需要指定
|
||||
valueEncoder: java
|
||||
valueDecoder: java
|
||||
|
||||
--- ### 验证码配置
|
||||
continew-starter.captcha:
|
||||
|
Reference in New Issue
Block a user