--- id: cachetools-async version: "0.0.5" license: MIT license_treatment: permissive maintenance: active --- # cachetools-async — Provides decorators that are inspired by and work closely with cachetools' for caching asyncio functions and methods. License: permissive · Maintenance: active · Downloads: 512.7K/mo ## 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 above — 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 pip install cachetools-async uv add cachetools-async poetry add cachetools-async ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 512.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async function caching, asyncio memoization decorator, cache async coroutines, cachetools async support, async result memoization, TTL cache for async functions, LRU cache asyncio, asyncio, caching, memoization [View on SkillFed](https://skillfed.io/packages/cachetools-async) · [View on PyPI](https://pypi.org/project/cachetools-async/)