--- id: cashews version: "7.5.0" license: MIT license_treatment: permissive maintenance: active --- # cashews — cache tools with async power License: permissive · Maintenance: active · Downloads: 755.2K/mo ## 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 above — 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 pip install cashews uv add cashews 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_current - Install friction: low - Maintenance: active - Downloads: 755.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async cache framework, redis cache decorator, async caching library, multi-backend cache, cache with ttl, async cache strategies, distributed cache, async-first, multi-backend, decorator-api [View on SkillFed](https://skillfed.io/packages/cashews) · [View on PyPI](https://pypi.org/project/cashews/)