--- id: memoization version: "0.4.0" license: MIT license_treatment: permissive maintenance: abandoned --- # memoization — A powerful caching library for Python, with TTL support and multiple algorithm options. (https://github.com/lonelyenvoy/python-memoization) License: permissive · Maintenance: abandoned · Downloads: 1.3M/mo ## 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 above — 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 pip install memoization uv add memoization poetry add memoization ## Installing 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_current - Install friction: high - Maintenance: abandoned - Downloads: 1.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags function result caching decorator, memoization with TTL support, cache with LRU LFU FIFO algorithms, decorator for function caching, unhashable argument caching, thread-safe function memoization, cache expiration time-to-live, caching, decorator, memoization [View on SkillFed](https://skillfed.io/packages/memoization) · [View on PyPI](https://pypi.org/project/memoization/)