// the find
grantjenks/python-diskcache
Python disk-backed cache (Django-compatible). Faster than Redis and Memcached. Pure-Python.
DiskCache is a SQLite-backed cache library for Python that stores values on disk rather than in memory. It fits the gap between Python's broken stdlib file cache and running a separate Redis/Memcached process — useful for single-machine workloads, batch pipelines, or anywhere you want persistence without infrastructure.
The atomicity and process-safety guarantees are real and tested with actual stress tests, not just asserted in the README. The `memoize_stampede` recipe handles cache stampede prevention correctly using probabilistic early recomputation — this is non-trivial and most projects get it wrong. FanoutCache sharding lets you scale write concurrency by partitioning across multiple SQLite databases, which sidesteps SQLite's write serialization neatly. The benchmark suite is honest: it shows where DiskCache wins and where it doesn't, and the methodology is explained.
Last meaningful commit was mid-2024 and the project has a quiet maintenance feel — open issues with no responses, Python version matrix stops at 3.10 in the docs. SQLite WAL mode helps but you will still hit contention pain if you have many concurrent writers; FanoutCache mitigates this but adds operational complexity. Values are pickled by default, which means you cannot share the cache between processes running different Python versions or languages, and deserialization of untrusted data is a latent footgun. There is no TTL-based background expiry — eviction only happens on write operations, so a cache that stops getting writes will hold stale data indefinitely until something touches it.