From 75f19e5d216f1d76ebf8b66b900078cc70bdaa91 Mon Sep 17 00:00:00 2001 From: LamGC Date: Thu, 1 Oct 2020 00:58:40 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=20CacheStore-api=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E7=BC=93=E5=AD=98=E5=AD=98=E5=82=A8=E6=BA=90=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=A0=87=E6=B3=A8,=20=E4=BB=A5=E5=8D=8F?= =?UTF-8?q?=E5=8A=A9=20Core=20=E6=8C=89=E9=9C=80=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=AE=B9=E5=99=A8;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Add] CacheStoreSource 增加缓存存储源类型枚举类, 暂时添加目前已涉及的类型; [Update] Factory 增加 CacheStoreSource 项目(因为 CacheStoreSource 是没有更改需要的; --- .../lamgc/cgj/bot/cache/CacheStoreSource.java | 37 +++++++++++++++++++ .../java/net/lamgc/cgj/bot/cache/Factory.java | 7 ++++ 2 files changed, 44 insertions(+) create mode 100644 ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreSource.java diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreSource.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreSource.java new file mode 100644 index 0000000..1f13777 --- /dev/null +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreSource.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 LamGC + * + * ContentGrabbingJi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * ContentGrabbingJi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package net.lamgc.cgj.bot.cache; + +/** + * 缓存容器类型. + * @author LamGC + */ +public enum CacheStoreSource { + /** + * 内存存储(速度最快). + */ + MEMORY, + /** + * 本地存储(单机存储). + */ + LOCAL, + /** + * 远端存储(例如网络, 可多机读写且与单机无关). + */ + REMOTE +} diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Factory.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Factory.java index ead8fbc..e7c885b 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Factory.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Factory.java @@ -47,4 +47,11 @@ public @interface Factory { */ int priority() default FactoryPriority.PRIORITY_NORMAL; + /** + * CacheStore 存储源类型. + *

可帮助 Core 根据需要选择对应的类型(比如部分低TTL临时缓存追求速度不强求持久化, 建立热点数据高频短时缓存等). + * @return 返回存储源类型. + */ + CacheStoreSource source() default CacheStoreSource.LOCAL; + }