短信配置缓存

This commit is contained in:
阿沐 2024-06-25 17:23:04 +08:00
parent a43ed499ab
commit ad3a8748ba
2 changed files with 57 additions and 49 deletions

View File

@ -1,8 +1,8 @@
package net.maku.message.cache;
package net.maku.system.cache;
import lombok.AllArgsConstructor;
import net.maku.framework.common.cache.RedisCache;
import net.maku.message.sms.config.SmsConfig;
import net.maku.sms.config.SmsConfig;
import org.springframework.stereotype.Service;
import java.util.List;
@ -15,18 +15,19 @@ import java.util.List;
*/
@Service
@AllArgsConstructor
public class SmsPlatformCache {
public class SmsConfigCache {
private final RedisCache redisCache;
/**
* 短信平台轮询KEY
*/
private final String SMS_ROUND_KEY = "message:sms:round";
private final String SMS_ROUND_KEY = "sys:sms:round";
private final String SMS_ROUND_CODE_KEY = "sys:sms:round:code";
/**
* 短信平台列表KEY
*/
private final String SMS_PLATFORM_KEY = "message:sms:platform";
private final String SMS_PLATFORM_KEY = "sys:sms:platform";
/**
* 获取短信轮询值
@ -35,6 +36,13 @@ public class SmsPlatformCache {
return redisCache.increment(SMS_ROUND_KEY);
}
/**
* 获取短信编码轮询值
*/
public Long getRoundCodeValue() {
return redisCache.increment(SMS_ROUND_CODE_KEY);
}
public List<SmsConfig> list() {
return (List<SmsConfig>) redisCache.get(SMS_PLATFORM_KEY);
}