cachetools-async
Provides decorators that are inspired by and work closely with cachetools' for caching asyncio functions and methods.
What it is and what it does
cachetools_async adds memoization decorators for asyncio coroutine functions, building on top of cachetools' cache implementations. It lets you decorate async functions with @cached to automatically store and reuse their results, using the same cache strategies (LRU, TTL, etc.) that cachetools provides for synchronous code. The cache itself is not asynchronous—it's a regular mutable mapping—but the decorator handles the async execution model correctly.
A key behavior: if multiple concurrent calls arrive for the same cached key before the first one completes, they all wait for that single result rather than each triggering a separate computation. This deduplication happens transparently, making it useful for scenarios like parallel requests for the same resource.
Use it for:
- Cache results from async HTTP requests (e.g., weather data, API responses) with TTL to avoid redundant network calls.
- Deduplicate concurrent async function calls in parallel workloads where multiple tasks request the same expensive computation.
- Implement LRU caching for async database queries or I/O operations to limit memory and improve response times.
- Add memoization to async data-fetching functions in web frameworks or async services without rewriting cache logic.
- Combine with cachetools' cache strategies to apply size limits and eviction policies to async coroutine results.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides async-aware memoization decorators for Python asyncio coroutines, extending cachetools with support for caching async function results using LRU, TTL, and other fixed-size cache strategies.
Yes. Low install friction, active maintenance, no known vulnerabilities, and MIT licensing make it a straightforward choice. Install it if you need memoization for asyncio functions and want to reuse cachetools' familiar cache strategies. The single cachetools dependency is lightweight and widely used.
Install
cachetools-async on PyPI
pip
pip install cachetools-asyncuv
uv add cachetools-asyncpoetry
poetry add cachetools-asyncInstalling cachetools-async
Before you install
Low friction: pure Python wheel with a single runtime dependency on cachetools. Actively maintained with recent releases; repository is not archived and receives commits.
License in practice
MIT license is permissive and imposes no significant restrictions on use, modification, or distribution in most contexts.
Quickstart
pip install cachetools_async
from cachetools import LRUCache
from cachetools_async import cached
@cached(cache=LRUCache(maxsize=32))
async def fetch_data(key):
# async work here
return result
await fetch_data(key)
Requires Python 3.9 or later.
Verify before relying
- Whether concurrent calls to the same cached async function with different arguments are deduplicated or only identical calls are coalesced.
- Performance characteristics and memory overhead compared to direct cachetools usage in async contexts.
- Thread-safety guarantees when the same cached function is called from multiple asyncio tasks or event loops.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — cachetools |
| Maintenance | actively maintained — 431 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 512,688/month — #6,255 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cachetools_async-0.0.5-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
asyncacheProvides decorator-based caching for async…
permissive · top 5,000 on PyPI
py-memoizeCaching library for async Python applications…
permissive · top 15,000 on PyPI
cachetoolsProvides memoizing collections and function…
permissive · top 1,000 on PyPI
onecacheOneCache provides LRU-based caching decorators…
permissive · top 15,000 on PyPI
cachettlcachettl provides LRU TTL cache decorators for…
permissive · top 15,000 on PyPI
shelved-cacheWraps cachetools cache implementations with…
permissive · top 5,000 on PyPI
memoizationDecorator-based function result caching with…
permissive · top 5,000 on PyPI
async-lruAn LRU cache decorator for async functions that…
permissive · top 1,000 on PyPI
methodtoolsProvides LRU caching for methods, classmethods,…
permissive · top 5,000 on PyPI
django-cache-memoizeA decorator that caches function results using…
copyleft · top 15,000 on PyPI