unistore-cache
内存缓存能力 - UniStore 能力生态的一部分。
功能特性
- LRU 淘汰: 基于最近最少使用策略自动淘汰
- TTL 支持: 可设置条目过期时间
- 线程安全: 使用 parking_lot 高性能锁
- 统计信息: 命中率、大小等缓存统计
- 泛型支持: 支持任意 Key-Value 类型
快速开始
use ;
use Duration;
// 创建缓存
let cache = new;
// 存取数据
cache.insert;
let value = cache.get;
配置选项
use CacheConfig;
use Duration;
let config = default
.max_capacity // 最大条目数
.default_ttl // 默认 TTL
.eviction_batch_size; // 批量淘汰数量
统计信息
let stats = cache.stats;
println!;
println!;
println!;
println!;
许可证
MIT OR Apache-2.0