mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-07-01 04:47:26 +00:00
[Add][Change] Common 更改 CacheStoreBuilder 为实例模式, 为 CacheStoreFactory 添加 initial 方法;
[Add] CacheStoreFactory 添加 'initial(File)' 方法供缓存组件进行初始化; [Change] CacheStoreBuilder 将 CacheStoreBuilder 从静态类更改为实例类, 增加对 CacheStoreFactory 的初始化; [Change] CacheStoreBuilderTest 适配 CacheStoreBuilder 的更改;
This commit is contained in:
@ -20,6 +20,8 @@ package net.lamgc.cgj.bot.cache;
|
||||
import net.lamgc.cgj.bot.cache.convert.StringConverter;
|
||||
import net.lamgc.cgj.bot.cache.exception.GetCacheStoreException;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 缓存存储容器构造工厂.
|
||||
*
|
||||
@ -28,6 +30,15 @@ import net.lamgc.cgj.bot.cache.exception.GetCacheStoreException;
|
||||
*/
|
||||
public interface CacheStoreFactory {
|
||||
|
||||
/**
|
||||
* Factory 初始化方法.
|
||||
* <p> 当 Factory 被加载且验证正确后, 将会在第一次获取 CacheStore 前被调用一次(也可能在验证完成后执行).
|
||||
* <p> 该方法仅调用一次, 之后将不再调用.
|
||||
* @param dataDirectory 数据存储目录, 可在该目录内存储配置, 或持久化缓存.
|
||||
* @throws Exception 上层管理类允许捕获任何抛出的异常, 如果 Factory 抛出异常, 将视为失效, 不被使用.
|
||||
*/
|
||||
void initial(File dataDirectory) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取一个新的 CacheStore 对象.
|
||||
* @param identify 缓存标识.
|
||||
|
Reference in New Issue
Block a user