lrucache-rs

Dict-like LRUCache in Rust for Python


Keywords
cache, caching, lru, lrucache, mapping, lru-cache
License
0BSD
Install
pip install lrucache-rs==1.0.0

Documentation

lrucache-rs

PyPI - Python Version Liberapay Patrons GitHub Sponsors

An efficient LRU cache written in Rust with Python bindings. Unlike other LRU cache implementations, this one behaves like a Python dictionary and does not wrap around a function.

Installation

Pre-built binary wheels are available for Linux, macOS, and Windows, with support for both x64 and ARM architectures.

pip install lrucache-rs

Basic usage

from lrucache_rs import LRUCache

cache: LRUCache[str, int] = LRUCache(maxsize=2)
cache['1'] = 1
cache['2'] = 2
cache['3'] = 3
assert cache.get('1') is None
assert cache.get('2') == 2
assert cache.get('3') == 3