日志切面功能整合

This commit is contained in:
Tankaikai
2025-02-13 14:29:14 +08:00
parent cde964492c
commit 8d8e338da8
29 changed files with 802 additions and 15 deletions

View File

@@ -7,6 +7,9 @@ package com.czg.config;
*/
public interface RedisCst {
String LOGIN_CODE = "login:code:";
String SYS_LOG_KEY = "sys:log:";
String SMS_CODE = "sms:code:";
}

View File

@@ -17,6 +17,16 @@ import java.util.concurrent.TimeUnit;
@Component
public class RedisService {
/**
* 默认过期时长为24小时单位
*/
public final static long DEFAULT_EXPIRE = 60 * 60 * 24L;
/**
* 不设置过期时长
*/
public final static long NOT_EXPIRE = -1L;
@Autowired
private final RedisTemplate<String, Object> redisTemplate;
@@ -554,4 +564,20 @@ public class RedisService {
}
}
public void leftPush(String key, Object value) {
leftPush(key, value, DEFAULT_EXPIRE);
}
public void leftPush(String key, Object value, long expire) {
redisTemplate.opsForList().leftPush(key, value);
if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
public Object rightPop(String key) {
return redisTemplate.opsForList().rightPop(key);
}
}