skillfed

memoization

A powerful caching library for Python, with TTL support and multiple algorithm options. (https://github.com/lonelyenvoy/python-memoization)

memoization v0.4.0 1.3M downloads/30d#4,157 on PyPI246
Permissive license MIT Abandoned released

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 memoization

uv

uv add memoization

poetry

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 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

function result caching decoratormemoization with TTL supportcache with LRU LFU FIFO algorithmsdecorator for function cachingunhashable argument cachingthread-safe function memoizationcache expiration time-to-live
cachingdecoratormemoization

More Libraries packages