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

Start with the DiskCache Tutorial and keep the DiskCache API Reference at hand.