py-memoize
Caching library for asynchronous Python applications (both based on asyncio and Tornado) that handles dogpiling properly and provides a configurable & extensible API.
Decision gist · record as of 2026-08-14
Yes, if you are building async Python services and need protection against cache stampede. The library is stable and has no known vulnerabilities, but note that maintenance is dormant (676 days since last release)—verify compatibility with your target Python version and async framework before adopting. For simple in-memory caching in active projects, consider whether the dormancy risk is acceptable.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Installs with no runtime dependencies.
- Maintenance is dormant—last release was 676 days ago (2024-10-07), though the repository remains active with 74 stars and no archived status.
License · maintenance · safety
Apache License 2.0 (permissive) — Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions.
last release 2024-10-07 (676 days) · last repo commit 2024-10-07 · 74 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 182,579 downloads/mo, #10,093 on PyPI
Alternatives
Verify before relying
pip install py-memoize
import asyncio
from memoize.wrapper import memoize
@memoize()
async def expensive_computation():
return 'result'
asyncio.run(expensive_computation())- Whether the dormant maintenance status (676 days since last release) affects compatibility with current Python async ecosystems
- Real-world performance impact of deep-copy post-processing on large cached objects
- Whether ujson extra dependency improves JSON serialization performance meaningfully
What it is and what it does
py-memoize is a caching library designed specifically for asynchronous Python code—both asyncio and Tornado—that solves the cache stampede (dog-piling) problem where multiple concurrent tasks simultaneously miss the cache and flood the underlying resource. It wraps expensive async functions with a decorator to cache and reuse their results, and includes built-in protections against concurrent cache misses.
The library is highly configurable: you can tune cache timeouts, key generation strategies, storage backends, eviction policies (least-recently-updated by default), and value post-processing (including optional deep-copy). It supports background cache refreshing with separate update and expiration delays, allowing stale values to be refreshed asynchronously without observable latency. All components are extensible, so you can plug in custom storage, key extraction, or eviction logic.
Use it for
- Memoize expensive async API calls or database queries in asyncio services to reduce latency and backend load
- Prevent cache stampede in high-concurrency async applications where multiple tasks would otherwise recompute the same result simultaneously
- Cache results with tunable background refresh to serve stale data while updating in the background, avoiding request latency spikes
- Implement custom cache storage (e.g., Redis, Memcached) by extending the provided storage and serialization interfaces
- Decorate Tornado async handlers to cache computed responses across concurrent requests
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building async Python services and need protection against cache stampede.
The library is stable and has no known vulnerabilities, but note that maintenance is dormant (676 days since last release)—verify compatibility with your target Python version and async framework before adopting. For simple in-memory caching in active projects, consider whether the dormancy risk is acceptable.
Install
py-memoize on PyPI
Before you install
Installs with no runtime dependencies. Maintenance is dormant—last release was 676 days ago (2024-10-07), though the repository remains active with 74 stars and no archived status.
License in practice
Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install py-memoize
import asyncio
from memoize.wrapper import memoize
@memoize()
async def expensive_computation():
return 'result'
asyncio.run(expensive_computation())
Verify before relying
- Whether the dormant maintenance status (676 days since last release) affects compatibility with current Python async ecosystems
- Real-world performance impact of deep-copy post-processing on large cached objects
- Whether ujson extra dependency improves JSON serialization performance meaningfully
Package facts
| License | Apache License 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 676 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 182,579 / month, #10,093 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: AsyncIOIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries |
Evidence: py_memoize-3.1.1-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 › “cache stampede prevention”
- py-memoizeCaching library for async Python applications that prevents cache…
- diskcache-weaveDisk-backed cache library that stores key-value pairs on disk and in…
- theineTheine is a high-performance in-memory cache with a Rust core,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also asyncache · cachetools-async · memoization · cacheout · django-memoize · django-cache-memoize · vercel-cache · cachetools · requests-cache · aiodataloader