Crate quick_cache

source ·
Expand description

Lightweight, high performance concurrent cache. It allows very fast access to the cached items with little overhead compared to a plain concurrent hash table. No allocations are ever performed unless the cache internal state table needs growing (which will eventually stabilize).

Eviction policy

The current eviction policy is a modified version of the Clock-PRO algorithm. It’s “scan resistent” and provides high hit rates, significantly better than a LRU eviction policy and comparable to other state-of-the art algorithms like W-TinyLFU.

Thread safety and Concurrency

Both sync (thread-safe) and unsync (non thread-safe) implementations are provided. The latter offers slightly better performance when thread safety is not required.

Two keys or QK keys

In addition to the standard key->value cache, a “two keys” cache (key, qey)->value is also available for cases where you want a cache keyed by a tuple like (K, Q). But due to limitations of the Borrow trait you cannot access such keys without building the tuple and thus potentially cloning K and/or Q.

Hasher

By default the crate uses ahash, which is enabled (by default) via a crate feature with the same name. If the ahash feature is disabled the crate defaults to the std lib implementation instead (currently Siphash13). Note that a custom hasher can also be provided if desirable.

Modules

Concurrent cache variants that can be used from multiple threads.
Non-concurrent cache variants.

Structs

Traits

Type Definitions