LRU Cache
LRUCache is a Python package for in-memory caching using the LRU (Least Recently Used) eviction policy. Unlike Python’s built-in OrderedDict-based approach, this implementation uses a min-heap priority queue to track access times, providing efficient eviction of the least recently used entry when the cache reaches capacity.
Features
- Zero dependencies with pure Python, no external libraries
- Granular TTL (time-to-live) expiration per cache entry
- Optional thread-safe mode via
threading.RLock - Cache introspection methods: inspect capacity, TTL, and contents at runtime
- Decorator-based caching for function return values
Usage
LRUCache only works in Python version 3.10 and above, you can install it with :
pip install lruheap
or, with uv package manager to faster installation :
uv pip install lruheap
Documentation
You can read the fully detailed explanation about this package in here
Contribution
Any contributions are much welcomed, and you can read on contribution page on how to contribute.
License
This package is licensed under the MIT License.
Release files for lruheap 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lruheap-1.3.1.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lruheap-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.5 kB
Release files / lruheap-1.3.1.tar.gz
| Download URL | lruheap-1.3.1.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5f4bc0ba94c5dc4b539bfc62886eb195dfd2d7d34faf357eb5ebb75de3ca9ce
|
|
BLAKE2b-256 checksum How to use checksums |
da510c23e4119b10462b583432380241654cadb270029a22a587e89f67fa51bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / lruheap-1.3.1-py3-none-any.whl
| Download URL | lruheap-1.3.1-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45ead673ba1483d88a4a63594231f7e8f058e248205269ad3e0018b7ebd9015f
|
|
BLAKE2b-256 checksum How to use checksums |
7761cd362a51e8141085505dbcd19d705edfd5d0e0cd0f3811e33da0f985c711
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|