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
DiskCache, published on PyPI as ``diskcache-community`` and imported as
``diskcache_community``. 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 :class:`SafeDisk <diskcache_community.SafeDisk>`. The README
in the repository explains why the fork exists and how to migrate.

Install it with pip and import ``diskcache_community``:

    $ pip install diskcache-community

Coming from diskcache 5.6.3, read :doc:`migrating`; to close the pickle
vulnerability, read :doc:`fix-cve-2025-69872`. Then start with the
:doc:`tutorial` and keep the :doc:`api` at hand. The
:doc:`benchmarks` compare DiskCache with memcached, Redis, lmdb and other
stores, and the fork with diskcache 5.6.3.

.. toctree::
   :maxdepth: 1
   :titlesonly:

   fix-cve-2025-69872
   migrating
   tutorial
   benchmarks
   cache-benchmarks
   djangocache-benchmarks
   case-study-web-crawler
   case-study-landing-page-caching
   sf-python-2017-meetup-talk
   comparisons
   api
   development

.. _`diskcache-community`: https://github.com/secondwindoss/diskcache-community
