A simple and fast on disk cache library
Actively maintained. Last release 2 days ago, commits in 14 of the last 26 weeks. A safe choice.
pip install pysciqlop-cacheREADME as published on PyPI with version 0.4.4.
SciQLop Cache
A fast, persistent, process-safe key-value cache for Python, with a C++20 core.
Store Python objects under keys on disk; any thread or process on the machine reads them back, safely, even at the same time. It speaks diskcache's API, so most code switches by changing the import.
pip install pysciqlop-cache
Wheels for Linux, macOS and Windows, x86-64 and ARM64, Python 3.10 to 3.15 (free-threaded builds included) and PyPy 3.11 and 3.12. 📖 Documentation
from pysciqlop_cache import Cache
cache = Cache("/tmp/my-cache")
cache["sensor/temperature"] = {"ts": 1710000000, "values": [21.3, 21.5, 21.4]}
print(cache["sensor/temperature"])
# {'ts': 1710000000, 'values': [21.3, 21.5, 21.4]}
What people use it for
Cache slow functions and API calls. Results survive restarts and are shared by every
process. ignore keeps sessions and clients out of the key; async def works too.
@cache.memoize(expire=3600, ignore={"session"})
def fetch(url, session):
return session.get(url).json()
Share results between worker processes. Workers of a multiprocessing pool share
one cache, whatever the start method (fork, forkserver, spawn); no server, no lock files.
