[Add] CacheStore-api 增加对缓存存储源类型的标注, 以协助 Core 按需选择缓存容器;

[Add] CacheStoreSource 增加缓存存储源类型枚举类, 暂时添加目前已涉及的类型;
[Update] Factory 增加 CacheStoreSource 项目(因为 CacheStoreSource 是没有更改需要的;
This commit is contained in:
LamGC 2020-10-01 00:58:40 +08:00
parent 1643891166
commit 75f19e5d21
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
2 changed files with 44 additions and 0 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
*/
package net.lamgc.cgj.bot.cache;
/**
* 缓存容器类型.
* @author LamGC
*/
public enum CacheStoreSource {
/**
* 内存存储(速度最快).
*/
MEMORY,
/**
* 本地存储(单机存储).
*/
LOCAL,
/**
* 远端存储(例如网络, 可多机读写且与单机无关).
*/
REMOTE
}

View File

@ -47,4 +47,11 @@ public @interface Factory {
*/ */
int priority() default FactoryPriority.PRIORITY_NORMAL; int priority() default FactoryPriority.PRIORITY_NORMAL;
/**
* CacheStore 存储源类型.
* <p> 可帮助 Core 根据需要选择对应的类型(比如部分低TTL临时缓存追求速度不强求持久化, 建立热点数据高频短时缓存等).
* @return 返回存储源类型.
*/
CacheStoreSource source() default CacheStoreSource.LOCAL;
} }