Interface FeatureStore
- All Known Implementing Classes:
CachedFeatureStore, FileFeatureStore, InMemoryFeatureStore, LruFeatureStore, RedisFeatureStore
public interface FeatureStore
Feature Store Interface
功能存储接口
Interface for storing and retrieving feature definitions.
用于存储和检索功能定义的接口。
Implementations | 实现:
InMemoryFeatureStore- In-memory storage | 内存存储FileFeatureStore- File-based storage | 文件存储LruFeatureStore- LRU cache storage | LRU缓存存储
Usage Examples | 使用示例:
FeatureStore store = new InMemoryFeatureStore();
store.save(Feature.builder("feature-1").alwaysOn().build());
Optional<Feature> feature = store.find("feature-1");
List<Feature> all = store.findAll();
Features | 主要功能:
- CRUD operations for feature flag persistence - 功能标志持久化的CRUD操作
- Listener support for change notification - 变更通知的监听器支持
Security | 安全性:
- Thread-safe: Implementation-dependent - 线程安全: 取决于实现
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-feature V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
save
-
find
-
findAll
-
delete
Delete a feature 删除功能- Parameters:
key- the feature key | 功能键- Returns:
- true if deleted | 如果删除成功返回true
-
exists
Check if a feature exists 检查功能是否存在- Parameters:
key- the feature key | 功能键- Returns:
- true if exists | 如果存在返回true
-
count
default int count()Get the count of features 获取功能数量- Returns:
- feature count | 功能数量
-
clear
void clear()Clear all features 清除所有功能
-