cache.MemoryCache

cache.MemoryCache(max_entries=8)

In-memory LRU cache. Fast, lives for the session.

Entries are copied on load. Callers routinely extend a returned trace in place (pm.compute_log_likelihood merges a log_likelihood group into it), which would otherwise mutate the cached entry itself and hand every later hit a trace the original run never produced. DiskCache already materializes a fresh object per load; this keeps the two consistent.

max_entries bounds the store: each entry is a full posterior, and the default instance lives for the whole process.