skillfed

cachebox

The fastest memoizing and caching Python library written in Rust

cachebox v6.2.5 14.6M downloads/30d#1,225 on PyPI425
Permissive license MIT Active released

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 cachebox

uv

uv add cachebox

poetry

poetry add cachebox

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: RustTopic :: Software Development :: LibrariesTyping :: Typed

Tags

fast python caching librarymemoization decoratorin-memory cachelru cache alternativerust-based caching
performancememoizationrust-extension

More Libraries packages