Cache¶
Pluggable cache backends for LLM classification and extraction results.
CacheBackend Protocol¶
CacheBackend
¶
Bases: Protocol
Minimal key-value cache protocol. Implement this to bring your own backend.
InMemoryCache¶
LRU-bounded in-memory cache. Default maxsize=10,000 entries. When full, the least recently accessed entry is evicted.
InMemoryCache
¶
Default cache — LRU-bounded OrderedDict, zero disk I/O.
maxsize limits the number of entries. When the limit is reached the
least-recently-used entry is evicted. Pass 0 to disable the limit.
SQLiteCache¶
SQLiteCache
¶
Opt-in persistent cache backed by SQLite. WAL mode for concurrent safety.
Usage
cache = SQLiteCache("~/.pygaeb/cache") # directory path cache = SQLiteCache("/tmp/my-cache")