lru-dict
An Dict like LRU container.
Decision gist · record as of 2026-08-14
Yes, if you need a fast, bounded cache with predictable memory use and can tolerate a C extension dependency. The MIT license, zero runtime dependencies, and broad platform support make it low-risk. However, the aging maintenance status (285 days since last release, seeking a lead maintainer) means you should verify the project's stability for your use case and be prepared to fork or switch if critical bugs emerge. For most new projects, consider whether a pure-Python alternative or functools.lru_cache suffices first.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; C extension must compile or a pre-built wheel must be available for your platform.
- Medium install friction due to compiled C extension requiring platform-specific wheels; however, wheels are provided for common architectures (x86_64, ARM, PPC64LE) across macOS, Linux, and Windows.
- Last release was 285 days ago; project is marked stable but seeking a lead maintainer.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute lru-dict freely provided you include the license notice.
last release 2025-11-02 (285 days) · last repo commit 2025-10-24 · 284 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,871,723 downloads/mo, #2,019 on PyPI
Alternatives
Verify before relying
pip install lru-dict
from lru import LRU
l = LRU(5) # Create container holding 5 items
l[1] = 'value'
print(l.items()) # Items in MRU order
l.set_size(3) # Resize at runtime; oldest items evicted- Whether the project's search for a lead maintainer signals risk of abandonment or is routine community stewardship.
- Performance characteristics (speed and memory gains) relative to pure-Python LRU implementations in current Python versions.
What it is and what it does
lru-dict is a fixed-capacity dictionary-like container implemented in C that automatically evicts the least recently used item when the size limit is exceeded. It provides dict-like access patterns (get, set, delete, iteration) while maintaining insertion and access order, and supports optional callbacks when items are evicted. The main use case is building efficient LRU caches where you need predictable memory bounds and fast lookups without the overhead of pure-Python implementations.
The package trades ease of installation (requires a C compiler or platform-specific wheel) for speed and memory efficiency. It supports runtime capacity changes, introspection of MRU/LRU items, and statistics gathering. With no runtime dependencies and support for Python 3.9 through 3.14, it integrates into most modern Python projects; the aging maintenance status and search for a lead maintainer are the main caveats.
Use it for
- Build a bounded HTTP response cache that automatically discards stale entries when memory pressure rises.
- Implement a session store with a fixed maximum number of concurrent users, evicting idle sessions automatically.
- Cache expensive database query results with a memory ceiling, ensuring the cache never grows unbounded.
- Speed up repeated computations in data processing pipelines by caching intermediate results with predictable memory use.
- Create a connection pool or resource manager that limits concurrent allocations and recycles the least-used resources.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need a fast, bounded cache with predictable memory use and can tolerate a C extension dependency.
The MIT license, zero runtime dependencies, and broad platform support make it low-risk. However, the aging maintenance status (285 days since last release, seeking a lead maintainer) means you should verify the project's stability for your use case and be prepared to fork or switch if critical bugs emerge. For most new projects, consider whether a pure-Python alternative or functools.lru_cache suffices first.
Install
lru-dict on PyPI
Before you install
Medium install friction due to compiled C extension requiring platform-specific wheels; however, wheels are provided for common architectures (x86_64, ARM, PPC64LE) across macOS, Linux, and Windows. Last release was 285 days ago; project is marked stable but seeking a lead maintainer.
Requires Python 3.9 or later; C extension must compile or a pre-built wheel must be available for your platform.
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute lru-dict freely provided you include the license notice.
Quickstart
pip install lru-dict
from lru import LRU
l = LRU(5) # Create container holding 5 items
l[1] = 'value'
print(l.items()) # Items in MRU order
l.set_size(3) # Resize at runtime; oldest items evicted
Verify before relying
- Whether the project's search for a lead maintainer signals risk of abandonment or is routine community stewardship.
- Performance characteristics (speed and memory gains) relative to pure-Python LRU implementations in current Python versions.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 285 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,871,723 / month, #2,019 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/StableIntended Audience :: DevelopersOperating System :: OS IndependentOperating System :: POSIXProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules |
Evidence: lru_dict-1.4.1-cp310-cp310-macosx_10_9_universal2.whl; lru_dict-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl; lru_dict-1.4.1-cp310-cp310-macosx_11_0_arm64.whl; lru_dict-1.4.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; lru_dict-1.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lru_dict-1.4.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; lru_dict-1.4.1-cp310-cp310-musllinux_1_2_aarch64.whl; lru_dict-1.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl; lru_dict-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl; lru_dict-1.4.1-cp310-cp310-win32.whl; lru_dict-1.4.1-cp310-cp310-win_amd64.whl; lru_dict-1.4.1-cp311-cp311-macosx_10_9_universal2.whl; lru_dict-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl; lru_dict-1.4.1-cp311-cp311-macosx_11_0_arm64.whl; lru_dict-1.4.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; lru_dict-1.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; lru_dict-1.4.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; lru_dict-1.4.1-cp311-cp311-musllinux_1_2_aarch64.whl; lru_dict-1.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl; lru_dict-1.4.1-cp311-cp311-musllinux_1_2_x86_64.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 › “lru cache dict”
- lru-dictA fast C-based LRU (Least Recently Used) dict container that evicts…
- cacheboxCachebox is a high-performance in-memory caching library written in…
- repoze-lruA lightweight LRU (least recently used) cache implementation that…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also pylru · repoze-lru · cacheout · circular-dict · cachetools · backports.functools-lru-cache · async-lru · functools32 · boltons · methodtools