https://github.com/zaczero/lrucache-rs
Fast dict-like LRUCache in Rust for Python
https://github.com/zaczero/lrucache-rs
caching lru-cache
Last synced: 4 months ago
JSON representation
Fast dict-like LRUCache in Rust for Python
- Host: GitHub
- URL: https://github.com/zaczero/lrucache-rs
- Owner: Zaczero
- License: 0bsd
- Created: 2024-09-13T22:30:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-21T22:12:23.000Z (over 1 year ago)
- Last Synced: 2026-01-18T16:44:17.685Z (5 months ago)
- Topics: caching, lru-cache
- Language: Python
- Homepage: https://pypi.org/p/lrucache-rs
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lrucache-rs
[](https://pypi.org/project/lrucache-rs)
[](https://liberapay.com/Zaczero/)
[](https://github.com/sponsors/Zaczero)
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.
```sh
pip install lrucache-rs
```
## Basic usage
```py
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
```