SciQLop CacheΒΆ

A fast, persistent, process-safe key-value cache for Python, with a C++20 core.

Think of it as a tiny local database for things that are expensive to compute or to download. You store Python objects under keys, and any thread or process on the machine can read them back, safely, even at the same time. Data survives restarts. The cache can be bounded in size, entries can expire, and nothing gets corrupted when processes crash, fork, or race each other.

from pysciqlop_cache import Cache

cache = Cache("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]}
$ pip install pysciqlop-cache

It follows the diskcache API, so most diskcache code runs unchanged, and it is 2x faster on writes and up to 6x faster in batched transactions.

What do you want to do?ΒΆ

⚑ Cache results in a script

Store and fetch values like in a dict, with expiration, size limits and one-line memoization of your functions.

Quickstart
πŸ”€ Share a cache between threads and processes

Worker pools, forked processes, GUI threads: transactions, locks, and what is safe to do at the same time.

Threads, processes and transactions
πŸ“ˆ Store big numpy arrays

Measurement series, images, spectrograms: write them without blocking your other threads, and let the cache compress what compresses well.

Serializers
πŸ—‚οΈ Pick the right store

Cache, Index, FanoutCache or FanoutIndex: what each one is for.

Choosing a store
πŸ” Move from diskcache

Migrate an existing cache in one command, and see where the two APIs still differ.

Coming from diskcache
🧱 Use it from C++

The same engine, header-only, from C++20.

C++ guide

Getting started