From a43ed499ab912e1b61e692a859372f06654c9979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=B2=90?= Date: Tue, 25 Jun 2024 17:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=85=8D=E7=BD=AE=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/maku/system/cache/EmailConfigCache.java | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 maku-boot-system/src/main/java/net/maku/system/cache/EmailConfigCache.java diff --git a/maku-boot-system/src/main/java/net/maku/system/cache/EmailConfigCache.java b/maku-boot-system/src/main/java/net/maku/system/cache/EmailConfigCache.java new file mode 100644 index 0000000..897a6cb --- /dev/null +++ b/maku-boot-system/src/main/java/net/maku/system/cache/EmailConfigCache.java @@ -0,0 +1,57 @@ +package net.maku.system.cache; + +import lombok.AllArgsConstructor; +import net.maku.email.config.EmailConfig; +import net.maku.framework.common.cache.RedisCache; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 邮件配置 Cache + * + * @author 阿沐 babamu@126.com + * MAKU + */ +@Service +@AllArgsConstructor +public class EmailConfigCache { + private final RedisCache redisCache; + + /** + * 邮件平台轮询KEY + */ + private final String SMS_ROUND_KEY = "sys:mail:round"; + private final String SMS_ROUND_CODE_KEY = "sys:mail:round:code"; + + /** + * 邮件平台列表KEY + */ + private final String SMS_PLATFORM_KEY = "sys:mail:platform"; + + /** + * 获取邮件轮询值 + */ + public Long getRoundValue() { + return redisCache.increment(SMS_ROUND_KEY); + } + + /** + * 获取邮件编码轮询值 + */ + public Long getRoundCodeValue() { + return redisCache.increment(SMS_ROUND_CODE_KEY); + } + + public List list() { + return (List) redisCache.get(SMS_PLATFORM_KEY); + } + + public void save(List list) { + redisCache.set(SMS_PLATFORM_KEY, list); + } + + public void delete() { + redisCache.delete(SMS_PLATFORM_KEY); + } +}