13 releases
| 0.3.0 | Jan 10, 2025 |
|---|---|
| 0.2.8 | Dec 2, 2023 |
| 0.2.7 | Oct 31, 2023 |
| 0.2.4 | Jun 19, 2023 |
| 0.2.0 | Sep 28, 2021 |
#253 in Data structures
2,305 downloads per month
Used in 5 crates
(2 directly)
355KB
5.5K
SLoC
Caches
This is a Rust implementation for popular caches (support no_std).
See Introduction, Installation and Usages for more details.
English | 简体中文
Introduction
The MSRV for this crate is 1.55.0.
- LRU
LRUCache,SegmentedCache,TwoQueueCacheandAdaptiveCache.
- LFU
TinyLFU,SampledLFU, andWTinyLFUCache
Installation
-
std
[dependencies] caches = "0.3" -
no_std
[dependencies] caches = { version = "0.3", default-features = false, features = ["libm", "hashbrown"] }
Usages
Please see examples.
Related
If you want a high-performance thread-safe modern cache, please see https://crates.io/crates/stretto
Acknowledgments
-
The implementation of
RawLRUis highly inspired by Jerome Froelich's LRU implementation andstd::collectionslibrary of Rust. -
Thanks for HashiCorp's golang-lru providing the amazing Go implementation.
-
Ramakrishna's paper: Caching strategies to improve disk system performance
-
The implementation of TinyLFU and SampledLFU are inspired by Dgraph's ristretto and dgryski's go-tinylfu.
-
Gil Einziger's paper: TinyLFU: A Highly Efficient Cache Admission Policy
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~0.9–1.7MB
~36K SLoC