--- id: diskcache version: "5.6.3" license: Apache 2.0 license_treatment: permissive maintenance: dormant --- # diskcache — Disk Cache -- Disk and file backed persistent cache. License: permissive · Maintenance: dormant · Popularity: top 1,000 on PyPI ## Install pip install diskcache uv add diskcache poetry add diskcache ## Description DiskCache: Disk Backed Cache ============================ `DiskCache`_ is an Apache2 licensed disk and file backed cache library, written in pure-Python, and compatible with Django. The cloud-based computing of 2023 puts a premium on memory. Gigabytes of empty space is left on disks as processes vie for memory. Among these processes is Memcached (and sometimes Redis) which is used as a cache. Wouldn't it be nice to leverage empty disk space for caching? Django is Python's most popular web framework and ships with several caching backends. Unfortunately the file-based cache in Django is essentially broken. The culling method is random and large caches repeatedly scan a cache directory which slows linearly with growth. Can you really allow it to take sixty milliseconds to store a key in a cache with a thousand items? In Python, we can do better. And we can do it in pure-Python! :: In [1]: import pylibmc In [2]: client = pylibmc.Client(['127.0.0.1'], binary=True) In [3]: client[b'key'] = b'value' In [4]: %timeit client[b'key'] 10000 loops, best of 3: 25.4 µs per loop In [5]: import diskcache as dc In [6]: cache = dc.Cache('tmp') In [7]:... ## AI interpretation — verify before relying DiskCache provides a pure-Python disk-backed cache library that stores key-value pairs using SQLite and the filesystem, offering thread-safe and process-safe caching with support for multiple eviction policies and Django integration. Verdict: DiskCache is a stable, well-tested pure-Python caching solution with zero runtime dependencies and permissive licensing, suitable for applications needing disk-backed persistence. However, the project is dormant (no releases since August 2023), so it carries security risk if vulnerabilities are discovered; two known vulnerabilities (GHSA-w8v5-vhqr-4h9v, PYSEC-2026-2447) are already present. [View on SkillFed](https://skillfed.io/packages/diskcache) · [View on PyPI](https://pypi.org/project/diskcache/)