tooluniverse.cache 软件包¶
ToolUniverse 缓存工具
子模块¶
tooluniverse.cache.memory_cache module¶
In-memory cache utilities for ToolUniverse.
提供一个轻量级、线程安全的LRU缓存,并支持可选的singleflight机制,用于减少高成本的缓存未命中情况。
tooluniverse.cache.result_cache_manager module¶
结果缓存管理器,用于协调内存和持久化存储。
- class tooluniverse.cache.result_cache_manager.CacheRecord[源代码]¶
基类:
objectCacheRecord(value: ‘任意类型’, expires_at: ‘可选[浮点数]’, namespace: ‘字符串’, version: ‘字符串’)
- __init__(value, expires_at, namespace, version)¶
- class tooluniverse.cache.result_cache_manager.ResultCacheManager[源代码]¶
基类:
object围绕内存和持久缓存层的外观模式。
- __init__(*, memory_size=256, persistent_path=None, enabled=True, persistence_enabled=True, singleflight=True, default_ttl=None, async_persist=None, async_queue_size=10000)[源代码]¶
tooluniverse.cache.sqlite_backend module¶
基于SQLite的ToolUniverse持久缓存。
缓存存储带有TTL和版本元数据的序列化工具结果。设计为内存缓存后端的可直接使用的持久层。
- class tooluniverse.cache.sqlite_backend.CacheEntry[源代码]¶
基类:
objectCacheEntry(key: ‘str’, value: ‘Any’, namespace: ‘str’, version: ‘str’, ttl: ‘Optional[int]’, created_at: ‘float’, last_accessed: ‘float’, hit_count: ‘int’, expires_at: ‘Optional[float]’ = None)
- __init__(key, value, namespace, version, ttl, created_at, last_accessed, hit_count, expires_at=None)¶