Skip to main content

Module cache

Module cache 

Source
Expand description

In-process LRU cache for read queries.

Keys are namespaced by table: "posts:list:limit=20,offset=0". Invalidation happens on any write to a given table — we simply blow away every key whose prefix matches "tablename:".

The LRU is behind a Mutex because lru::LruCache::get needs &mut self (it updates recency). We keep the cache small and the critical section tiny — a few µs per lookup in the worst case.

Structs§

QueryCache