cachebox
The fastest memoizing and caching Python library written in Rust
What it is and what it does
Cachebox is a Rust-based caching library that accelerates Python applications by storing computed results in memory and reusing them on subsequent calls with identical arguments. It provides seven cache algorithms (FIFO, LRU, and others) and can be used either as a decorator for functions or as a standalone dictionary-like cache object. The library is designed to be thread-safe, have minimal memory overhead, and avoid cache stampede through distributed locking.
You would use cachebox when your application repeatedly accesses the same data or performs expensive computations, database queries, or API calls. It copies mutable objects (dict, list, set) by default, preventing accidental mutations from affecting cached results—a behavior that distinguishes it from Python's built-in functools.lru_cache. The package has zero Python dependencies and supports both synchronous and asynchronous functions.
Use it for:
- Memoizing expensive mathematical or data-processing functions to avoid redundant computation.
- Caching database query results to reduce load and latency in web applications.
- Storing API responses to minimize external requests and manage rate-limit quotas.
- Accelerating machine learning inference by caching predictions for repeated input data.
- Reducing rendering time in web frameworks by caching generated HTML or template results.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Cachebox is a high-performance in-memory caching library written in Rust that provides multiple cache algorithms (FIFO, LRU, and others) for memoizing function results and storing arbitrary data with minimal overhead.
Yes. Cachebox is actively maintained, has no known vulnerabilities, supports current Python versions, and offers a permissive MIT license. The compiled-wheel distribution is straightforward on common platforms. Install it if you need fast, thread-safe caching with multiple eviction policies and minimal setup overhead—particularly valuable in high-traffic or compute-intensive applications.
Install
cachebox on PyPI
pip
pip install cacheboxuv
uv add cacheboxpoetry
poetry add cacheboxInstalling cachebox
Before you install
Medium install friction due to compiled wheels, but pre-built binaries are available for common platforms (macOS, Linux, Windows) and Python 3.10+. The package is actively maintained with a recent release (4 days old) and no known vulnerabilities.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install cachebox
import cachebox
@cachebox.cached(cachebox.LRUCache(maxsize=128))
def expensive_function(x):
return x ** 2
result = expensive_function(5)
Requires Python 3.10 or later; PyPy and CPython both supported.
Verify before relying
- Whether the claimed 10-50x performance improvement over other caching libraries holds for your specific use case and cache size.
- Thread-safety guarantees under high concurrency loads in production environments.
- Behavior of cache eviction policies under memory pressure or with very large datasets.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,576,959/month — #1,225 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cachebox-6.2.5-cp310-cp310-macosx_10_12_x86_64.whl; cachebox-6.2.5-cp310-cp310-macosx_11_0_arm64.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cachebox-6.2.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; cachebox-6.2.5-cp310-cp310-musllinux_1_2_aarch64.whl; cachebox-6.2.5-cp310-cp310-musllinux_1_2_armv7l.whl; cachebox-6.2.5-cp310-cp310-musllinux_1_2_i686.whl; cachebox-6.2.5-cp310-cp310-musllinux_1_2_x86_64.whl; cachebox-6.2.5-cp310-cp310-win32.whl; cachebox-6.2.5-cp310-cp310-win_amd64.whl; cachebox-6.2.5-cp311-cp311-macosx_10_12_x86_64.whl; cachebox-6.2.5-cp311-cp311-macosx_11_0_arm64.whl; cachebox-6.2.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cachebox-6.2.5-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; cachebox-6.2.5-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; cachebox-6.2.5-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl
Keywords: caching, cached, cachebox, cache, in-memory-caching, memoizing
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
cacheoutCacheout provides in-memory caching with…
permissive · top 5,000 on PyPI
cachetoolsProvides memoizing collections and function…
permissive · top 1,000 on PyPI
memoizationDecorator-based function result caching with…
permissive · top 5,000 on PyPI
cacheyCachey provides intelligent caching for…
permissive · top 15,000 on PyPI
theineTheine is a high-performance in-memory cache…
permissive · top 15,000 on PyPI
async-lruAn LRU cache decorator for async functions that…
permissive · top 1,000 on PyPI
soldrSoldr is a Python wrapper that downloads Rust…
permissive · top 15,000 on PyPI
cachetools-asyncProvides async-aware memoization decorators for…
permissive · top 15,000 on PyPI
onecacheOneCache provides LRU-based caching decorators…
permissive · top 15,000 on PyPI
pytest-antilruClears functools.lru_cache between pytest test…
permissive · top 15,000 on PyPI