skillfed

cashews

cache tools with async power

cashews v7.5.0 755.2K downloads/30d#5,141 on PyPI590
Permissive license MIT Active released

What it is and what it does

Cashews is an async-first caching library that wraps multiple storage backends (in-memory, Redis, DiskCache) under a unified decorator and function-call API. It lets you cache async function results with configurable TTL, custom key templates, and cache invalidation strategies—useful for reducing load on slow operations or external services in async applications.

The library emphasizes ease of use through decorators and supports advanced techniques like client-side caching (claimed to be faster than simple Redis caching), bloom filters, compression, and transactional modes. You can mix backends by prefix, serialize complex objects with pickle or dill, and monitor cache hits/misses. It has no required runtime dependencies, making installation lightweight; optional extras unlock Redis, DiskCache, and serialization features.

Use it for:

  • Decorate long-running async functions to cache results with automatic TTL expiry and key templating.
  • Set up multi-tier caching (in-memory + Redis) by prefix to balance speed and shared state.
  • Cache database query results or API responses in async web frameworks like FastAPI.
  • Implement cache invalidation by tags or time-based strategies to keep stale data out.
  • Use client-side caching with Redis to reduce round-trips and improve latency in high-throughput services.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Async cache framework with decorator and direct API support for in-memory, Redis, and DiskCache backends, including TTL management, cache invalidation, and optional client-side caching.

Yes. Cashews is production-ready (stable classifier, active maintenance, no known vulnerabilities), has low install friction, and offers a clean async API with flexible backends. Choose it if you need decorator-based caching in async code and want to avoid vendor lock-in to a single backend. The optional extras (Redis, DiskCache) let you start simple and scale later.

Install

cashews on PyPI

pip

pip install cashews

uv

uv add cashews

poetry

poetry add cashews

Installing cashews

Before you install

Low friction: pure Python wheel with no runtime dependencies. Active maintenance with recent release (165 days ago) and 590 repository stars. Supports Python 3.10–3.14.

License in practice

MIT license (permissive) allows commercial and private use with minimal restrictions.

Quickstart

pip install cashews

from cashews import cache

await cache.setup("mem://")

@cache(ttl="3h", key="user:{request.user.uid}")
async def long_running_function(request):
    return result

Requires Python 3.10 or later. Optional backends (Redis, DiskCache, dill, xxhash) require separate package installation.

Verify before relying

  • Performance claim ('2x faster than aiocache') lacks benchmark details or methodology.
  • Actual memory footprint and scalability limits for in-memory backend with large datasets.
  • Transactionality semantics and guarantees across different backends.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 165 days since the last release
Last repo commit
First released
Downloads 755,176/month — #5,141 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cashews-7.5.0-py3-none-any.whl

Keywords: cache, aio, async, multicache, aiocache

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming 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.14

Tags

async cache frameworkredis cache decoratorasync caching librarymulti-backend cachecache with ttlasync cache strategiesdistributed cache
async-firstmulti-backenddecorator-api

More Database packages