async-lru
Simple LRU cache for asyncio
Decision gist · record as of 2026-08-14
Yes. Production-stable, actively maintained, zero vulnerabilities, and low install friction. Use it whenever you need to cache async function results with deduplication of concurrent calls—a common pattern in async I/O applications. The single-loop affinity constraint is straightforward to work around in multi-loop scenarios.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Cache instance is bound to a single event loop; using it across different loops raises RuntimeError.
- Low friction: pure Python wheel with a single lightweight runtime dependency (typing_extensions).
License · maintenance · safety
MIT License (permissive) — MIT License permits commercial and private use with minimal restrictions—suitable for most projects.
last release 2026-03-19 (148 days) · last repo commit 2026-08-10 · 951 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 48,158,538 downloads/mo, #596 on PyPI
Alternatives
Verify before relying
pip install async-lru
from async_lru import alru_cache
@alru_cache(maxsize=32)
async def get_data(key):
return key * 2
await get_data(5) # Returns 10
get_data.cache_info() # View hit/miss counts- Performance characteristics compared to alternatives or uncached async functions
- Memory overhead of the cache structure relative to maxsize
- Behavior when concurrent calls exceed available system resources
What it is and what it does
async-lru is a port of Python's built-in functools.lru_cache for asyncio functions. It caches the results of async function calls and automatically deduplicates concurrent invocations—when multiple coroutines await the same uncached arguments simultaneously, only one actual function call executes, and all awaiters receive the same result. This prevents redundant work and thundering-herd problems in high-concurrency scenarios.
The decorator supports LRU eviction (bounded cache), TTL expiration with optional jitter to spread invalidations, explicit cache invalidation by arguments, and introspection methods (cache_info, cache_contains). It enforces single-loop affinity: a cache instance must be used with only one event loop, though separate instances can be created per loop in multi-loop applications.
Use it for
- Cache HTTP responses in async web scrapers or API clients to avoid redundant network calls
- Deduplicate database queries when multiple concurrent requests ask for the same data
- Memoize expensive async computations with TTL to balance freshness and performance
- Prevent thundering-herd cache stampedes by ensuring only one refresh call per expired key
- Speed up async test fixtures by caching setup results across test runs
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Production-stable, actively maintained, zero vulnerabilities, and low install friction. Use it whenever you need to cache async function results with deduplication of concurrent calls—a common pattern in async I/O applications. The single-loop affinity constraint is straightforward to work around in multi-loop scenarios.
Install
async-lru on PyPI
Before you install
Low friction: pure Python wheel with a single lightweight runtime dependency (typing_extensions). Active maintenance with recent releases and no known vulnerabilities.
Requires Python 3.10 or later. Cache instance is bound to a single event loop; using it across different loops raises RuntimeError.
License in practice
MIT License permits commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install async-lru
from async_lru import alru_cache
@alru_cache(maxsize=32)
async def get_data(key):
return key * 2
await get_data(5) # Returns 10
get_data.cache_info() # View hit/miss counts
Verify before relying
- Performance characteristics compared to alternatives or uncached async functions
- Memory overhead of the cache structure relative to maxsize
- Behavior when concurrent calls exceed available system resources
Package facts
| License | MIT License permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping_extensions |
| Maintenance | Actively maintained 148 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 48,158,538 / month, #596 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming 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 |
Evidence: async_lru-2.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “async lru cache decorator”
- async-lruAn LRU cache decorator for async functions that deduplicates…
- cachetools-asyncProvides async-aware memoization decorators for Python asyncio…
- cachettlcachettl provides LRU TTL cache decorators for both synchronous and…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
In-memory async cache for Python applications with TTL, LRU eviction, thundering herd protection, and DataLoader-style batching to reduce redundant work under concurrent load.
cachettl provides LRU TTL cache decorators for both synchronous and asynchronous functions, with configurable size limits, type-aware caching, and cache statistics tracking.
However, maintenance is dormant (last commit July 2024, no updates since), so adopt it only if you accept that bug fixes or feature requests may not be addressed.
OneCache provides LRU-based caching decorators for both synchronous and asynchronous Python functions, with optional per-entry TTL expiration and configurable memory limits.
Install it if you need simple LRU caching with optional TTL and don't want to manage an external cache service.
Clears functools.lru_cache between pytest test runs to prevent test pollution from cached values persisting across tests.
Decorator-based function result caching with configurable TTL, multiple eviction algorithms (LRU, LFU, FIFO), and support for unhashable arguments.
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.
Install it if you need memoization for asyncio functions and want to reuse cachetools' familiar cache strategies.
See also backports.functools-lru-cache · asyncache · cacheout · functools32