DiskCache: Disk Backed CacheΒΆ
DiskCache is an Apache2 licensed disk and file backed cache library, written
in pure Python, and compatible with Django. It stores keys and values in a
SQLite database and in files next to it, is safe to share between threads and
processes, evicts by LRU, LFU and other policies, and ships Deque and
Index containers plus recipes for memoization, locks and throttling.
This documentation describes diskcache-community, a community fork of
python-diskcache. The fork is published on PyPI as diskcache-community
and imported as diskcache_community, so it installs next to the upstream
diskcache package. It keeps the public API, the cache.db schema and
the file layout of the last upstream release, 5.6.3, so existing cache
directories keep working, and it carries the fix path for CVE-2025-69872
through the opt-in SafeDisk. The README
in the repository explains why the fork exists and how to migrate.
Install it with pip and import diskcache_community where you imported
diskcache:
$ pip install diskcache-community
Coming from diskcache 5.6.3, read Migrating from diskcache 5.6.3; to close the pickle vulnerability, read Fix CVE-2025-69872 in diskcache. Then start with the DiskCache Tutorial and keep the DiskCache API Reference at hand. The DiskCache Benchmarks compare DiskCache with memcached, Redis, lmdb and other stores, and the fork with diskcache 5.6.3.
- Fix CVE-2025-69872 in diskcache
- Migrating from diskcache 5.6.3
- DiskCache Tutorial
- DiskCache Benchmarks
- Old Cache Benchmarks (2019)
- Old DjangoCache Benchmarks (2019)
- Case Study: Web Crawler
- Case Study: Landing Page Caching
- Talk: All Things Cached - SF Python 2017 Meetup
- Comparisons
- DiskCache API Reference
- DiskCache Development