Redis 缓存,使用 : 单冒号,而不是双 : 冒号
This commit is contained in:
parent
1e4735c1fc
commit
2379b0d544
|
@ -1 +1 @@
|
||||||
cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl
|
cn.iocoder.yudao.framework.captcha.core.RedisCaptchaServiceImpl
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class IdempotentRedisDAO {
|
||||||
/**
|
/**
|
||||||
* 幂等操作的 Redis Key 模板
|
* 幂等操作的 Redis Key 模板
|
||||||
*
|
*
|
||||||
* KEY 格式:idempotent::{uuid}
|
* KEY 格式:idempotent:{uuid}
|
||||||
* VALUE 格式:空字符串
|
* VALUE 格式:空字符串
|
||||||
* 过期时间:动态传参
|
* 过期时间:动态传参
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.iocoder.yudao.framework.redis.config;
|
package cn.iocoder.yudao.framework.redis.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.redis.core.TimeoutRedisCacheManager;
|
import cn.iocoder.yudao.framework.redis.core.TimeoutRedisCacheManager;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
||||||
|
@ -35,8 +36,11 @@ public class YudaoCacheAutoConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) {
|
public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) {
|
||||||
// 设置使用 JSON 序列化方式
|
|
||||||
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
|
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig();
|
||||||
|
// 设置使用 : 单冒号,而不是双 :: 冒号,避免 Redis Desktop Manager 多余空格
|
||||||
|
// 详细可见 https://blog.csdn.net/chuixue24/article/details/103928965 博客
|
||||||
|
config = config.computePrefixWith(cacheName -> cacheName + StrUtil.COLON);
|
||||||
|
// 设置使用 JSON 序列化方式
|
||||||
config = config.serializeValuesWith(
|
config = config.serializeValuesWith(
|
||||||
RedisSerializationContext.SerializationPair.fromSerializer(buildRedisSerializer()));
|
RedisSerializationContext.SerializationPair.fromSerializer(buildRedisSerializer()));
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 通知任务的分布式锁
|
* 通知任务的分布式锁
|
||||||
*
|
*
|
||||||
* KEY 格式:pay_notify::{id}
|
* KEY 格式:pay_notify:{id}
|
||||||
* VALUE 数据类型:HASH {@link RLock}
|
* VALUE 数据类型:HASH {@link RLock}
|
||||||
* 过期时间:动态传参
|
* 过期时间:动态传参
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 指定部门的所有子部门编号数组的缓存
|
* 指定部门的所有子部门编号数组的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:dept_children_ids::{id}
|
* KEY 格式:dept_children_ids:{id}
|
||||||
* VALUE 数据类型:String 子部门编号集合
|
* VALUE 数据类型:String 子部门编号集合
|
||||||
*/
|
*/
|
||||||
String DEPT_CHILDREN_ID_LIST = "dept_children_ids";
|
String DEPT_CHILDREN_ID_LIST = "dept_children_ids";
|
||||||
|
@ -20,7 +20,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 角色的缓存
|
* 角色的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:role::{id}
|
* KEY 格式:role:{id}
|
||||||
* VALUE 数据类型:String 角色信息
|
* VALUE 数据类型:String 角色信息
|
||||||
*/
|
*/
|
||||||
String ROLE = "role";
|
String ROLE = "role";
|
||||||
|
@ -28,7 +28,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 用户拥有的角色编号的缓存
|
* 用户拥有的角色编号的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:user_role_ids::{userId}
|
* KEY 格式:user_role_ids:{userId}
|
||||||
* VALUE 数据类型:String 角色编号集合
|
* VALUE 数据类型:String 角色编号集合
|
||||||
*/
|
*/
|
||||||
String USER_ROLE_ID_LIST = "user_role_ids";
|
String USER_ROLE_ID_LIST = "user_role_ids";
|
||||||
|
@ -36,7 +36,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 拥有指定菜单的角色编号的缓存
|
* 拥有指定菜单的角色编号的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:user_role_ids::{menuId}
|
* KEY 格式:user_role_ids:{menuId}
|
||||||
* VALUE 数据类型:String 角色编号集合
|
* VALUE 数据类型:String 角色编号集合
|
||||||
*/
|
*/
|
||||||
String MENU_ROLE_ID_LIST = "menu_role_ids";
|
String MENU_ROLE_ID_LIST = "menu_role_ids";
|
||||||
|
@ -44,7 +44,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 拥有权限对应的菜单编号数组的缓存
|
* 拥有权限对应的菜单编号数组的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:permission_menu_ids::{permission}
|
* KEY 格式:permission_menu_ids:{permission}
|
||||||
* VALUE 数据类型:String 菜单编号数组
|
* VALUE 数据类型:String 菜单编号数组
|
||||||
*/
|
*/
|
||||||
String PERMISSION_MENU_ID_LIST = "permission_menu_ids";
|
String PERMISSION_MENU_ID_LIST = "permission_menu_ids";
|
||||||
|
@ -52,7 +52,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* OAuth2 客户端的缓存
|
* OAuth2 客户端的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:user::{id}
|
* KEY 格式:user:{id}
|
||||||
* VALUE 数据类型:String 客户端信息
|
* VALUE 数据类型:String 客户端信息
|
||||||
*/
|
*/
|
||||||
String OAUTH_CLIENT = "oauth_client";
|
String OAUTH_CLIENT = "oauth_client";
|
||||||
|
@ -60,17 +60,17 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 访问令牌的缓存
|
* 访问令牌的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:oauth2_access_token::{token}
|
* KEY 格式:oauth2_access_token:{token}
|
||||||
* VALUE 数据类型:String 访问令牌信息 {@link OAuth2AccessTokenDO}
|
* VALUE 数据类型:String 访问令牌信息 {@link OAuth2AccessTokenDO}
|
||||||
*
|
*
|
||||||
* 由于动态过期时间,使用 RedisTemplate 操作
|
* 由于动态过期时间,使用 RedisTemplate 操作
|
||||||
*/
|
*/
|
||||||
String OAUTH2_ACCESS_TOKEN = "oauth2_access_token::%s";
|
String OAUTH2_ACCESS_TOKEN = "oauth2_access_token:%s";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站内信模版的缓存
|
* 站内信模版的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:notify_template::{code}
|
* KEY 格式:notify_template:{code}
|
||||||
* VALUE 数据格式:String 模版信息
|
* VALUE 数据格式:String 模版信息
|
||||||
*/
|
*/
|
||||||
String NOTIFY_TEMPLATE = "notify_template";
|
String NOTIFY_TEMPLATE = "notify_template";
|
||||||
|
@ -78,7 +78,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 邮件账号的缓存
|
* 邮件账号的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:sms_template::{id}
|
* KEY 格式:sms_template:{id}
|
||||||
* VALUE 数据格式:String 账号信息
|
* VALUE 数据格式:String 账号信息
|
||||||
*/
|
*/
|
||||||
String MAIL_ACCOUNT = "mail_account";
|
String MAIL_ACCOUNT = "mail_account";
|
||||||
|
@ -86,7 +86,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 邮件模版的缓存
|
* 邮件模版的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:mail_template::{code}
|
* KEY 格式:mail_template:{code}
|
||||||
* VALUE 数据格式:String 模版信息
|
* VALUE 数据格式:String 模版信息
|
||||||
*/
|
*/
|
||||||
String MAIL_TEMPLATE = "mail_template";
|
String MAIL_TEMPLATE = "mail_template";
|
||||||
|
@ -94,7 +94,7 @@ public interface RedisKeyConstants {
|
||||||
/**
|
/**
|
||||||
* 短信模版的缓存
|
* 短信模版的缓存
|
||||||
*
|
*
|
||||||
* KEY 格式:sms_template::{id}
|
* KEY 格式:sms_template:{id}
|
||||||
* VALUE 数据格式:String 模版信息
|
* VALUE 数据格式:String 模版信息
|
||||||
*/
|
*/
|
||||||
String SMS_TEMPLATE = "sms_template";
|
String SMS_TEMPLATE = "sms_template";
|
||||||
|
|
Loading…
Reference in New Issue