memoization
A powerful caching library for Python, with TTL support and multiple algorithm options. (https://github.com/lonelyenvoy/python-memoization)
What it is and what it does
Memoization is a decorator-based caching library that stores function results to avoid recomputation on repeated calls with the same arguments. It extends Python's built-in functools.lru_cache by adding TTL (time-to-live) expiration, multiple eviction algorithms (LRU, LFU, FIFO), support for unhashable argument types like dicts and lists, and custom cache key generation. The library is thread-safe by default and provides cache statistics (hits, misses, size) for monitoring.
The package is designed for functions where repeated computation is expensive—database queries, API calls, or complex calculations—and where you need finer control over cache behavior than the standard library offers. It handles edge cases like hash collision attacks by always treating arguments as typed (f(3) and f(3.0) cache separately) and allows custom key makers for non-built-in object types.
Use it for:
- Cache expensive database queries with automatic expiration using TTL to keep results fresh.
- Decorate API client methods to avoid redundant network calls while respecting rate limits.
- Memoize recursive algorithms or mathematical computations with bounded cache size using LFU or FIFO eviction.
- Cache results of functions accepting unhashable arguments (dicts, lists) that functools.lru_cache cannot handle.
- Monitor cache effectiveness in production via cache_info() to tune max_size and algorithm choice.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Decorator-based function result caching with configurable TTL, multiple eviction algorithms (LRU, LFU, FIFO), and support for unhashable arguments.
No—the package is abandoned (last update August 2021, no commits for 1839 days) and receives no maintenance or security updates. While the MIT license is permissive and the library is stable for existing code, the high install friction combined with unmaintained status makes it a poor choice for new projects. Consider functools.lru_cache for standard use cases or an actively maintained alternative for TTL/algorithm flexibility.
Install
memoization on PyPI
pip
pip install memoizationuv
uv add memoizationpoetry
poetry add memoizationInstalling memoization
Before you install
High install friction: package is abandoned (last commit 2021-08-01, 1839 days ago) with no runtime dependencies. No recent maintenance or security updates available.
License in practice
MIT license permits permissive use, modification, and distribution with minimal restrictions—suitable for most projects, though abandoned status means no ongoing license compliance updates.
Quickstart
from memoization import cached
@cached
def expensive_function(arg):
return arg * 2
result = expensive_function(5) # cached on repeat calls
Requires Python 3.4 or later (supports 3.4–3.10); no external dependencies but package is unmaintained since 2021.
Verify before relying
- Whether the package works correctly with Python 3.11+ despite classifier support only through 3.10.
- Whether thread-safety implementation remains sound given no updates since 2021.
- Real-world performance impact of the order_independent option relative to default behavior.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4) |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,839 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,253,785/month — #4,157 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: memoization-0.4.0.tar.gz
Keywords: memoization, memorization, remember, decorator, cache, caching, function, callable, functional, ttl, limited, capacity, fast, high-performance, optimization
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
cacheoutCacheout provides in-memory caching with…
permissive · top 5,000 on PyPI
cachetoolsProvides memoizing collections and function…
permissive · top 1,000 on PyPI
kleptoklepto provides multiple caching algorithms…
permissive · top 15,000 on PyPI
cachettlcachettl provides LRU TTL cache decorators for…
permissive · top 15,000 on PyPI
python-redis-cacheDecorator-based caching for Python functions…
permissive · top 15,000 on PyPI
django-cache-memoizeA decorator that caches function results using…
copyleft · top 15,000 on PyPI
async-lruAn LRU cache decorator for async functions that…
permissive · top 1,000 on PyPI
cached_methodProvides a method-level caching decorator that…
permissive · top 15,000 on PyPI
methodtoolsProvides LRU caching for methods, classmethods,…
permissive · top 5,000 on PyPI
asyncacheProvides decorator-based caching for async…
permissive · top 5,000 on PyPI