zccache

raw JSON →
1.3.10 verified Fri May 01 auth: no python

A high-performance local compiler cache daemon for Python, designed to accelerate repetitive compilation tasks. Requires Python >=3.10. Latest version: 1.3.10, released with monthly patches under active development.

pip install zccache
error ModuleNotFoundError: No module named 'zccache'
cause zccache not installed or virtual environment not activated.
fix
Run 'pip install zccache' and ensure you are in the correct environment.
error AttributeError: module 'zccache' has no attribute 'Cache'
cause Breaking change in v1.3.0: 'Cache' was renamed to 'Config'.
fix
Use 'zccache.Config' instead of 'zccache.Cache'.
breaking In v1.3.0, the `Cache` class was renamed to `Config`. Old code using `zccache.Cache(...)` will raise AttributeError.
fix Replace `zccache.Cache(...)` with `zccache.Config(...)`.
gotcha The daemon must be started before any run() call; otherwise run() silently falls back to uncached execution.
fix Always call daemon.start() before invoking zccache.run().

Initialize a zccache daemon, run a compiler command, and retrieve cached results.

import zccache

# Configure and start the daemon
config = zccache.Config(cache_dir="/tmp/zccache", max_size="1GB")
daemon = zccache.Daemon(config)
daemon.start()

# Use the cache for compilation
result = zccache.run("gcc -O2 main.c -o main")
print(result)

daemon.stop()