Caches

[github][Github-url] [Build][CI-url] [codecov][codecov-url] [docs.rs][doc-url] [crates.io][crates-url] [license-apache][license-apache-url] [license-mit][license-mit-url] This is a Rust implementation for popular caches (support no_std). See [Introduction](#introduction), [Installation](#installation) and [Usages](#usages) for more details. [English](README.md) | 简体中文
## Introduction The MSRV for this crate is 1.55.0. - LRU - `LRUCache`, `SegmentedCache`, `TwoQueueCache` and `AdaptiveCache`. - LFU - `TinyLFU`, `SampledLFU`, and `WTinyLFUCache` ## Installation - std ```toml [dependencies] caches = "0.2" ``` - no_std ```toml [dependencies] caches = { version: "0.2", default-features = false } ``` ## Usages Please see [`examples`]. ## Acknowledgments - The implementation of `RawLRU` is highly inspired by [Jerome Froelich's LRU implementation](https://github.com/jeromefroe/lru-rs) and [`std::collections`] library of Rust. - Thanks for [HashiCorp's golang-lru](https://github.com/hashicorp/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] ## Roadmap - [x] `0.2`: Support TinyLFU, SampledLFU, WTinyLFUCache - [ ] `0.3`: Support LIRS, DLIRS, DSLRU - [ ] `0.4`: Add ttl feature to support #### 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. [`Rc`]: https://doc.rust-lang.org/std/rc/struct.Rc.html [`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html [`mem::swap`]: https://doc.rust-lang.org/stable/std/mem/fn.swap.html [`std::collections`]: https://doc.rust-lang.org/stable/std/collections/ [Github-url]: https://github.com/al8n/caches-rs/ [CI-url]: https://github.com/al8n/caches-rs/actions/workflows/ci.yml [codecov-url]: https://codecov.io/gh/al8n/caches-rs [license-apache-url]: https://opensource.org/licenses/Apache-2.0 [license-mit-url]: https://opensource.org/licenses/Apache-2.0 [crates-url]: https://crates.io/crates/caches [doc-url]: https://docs.rs/caches [documents]: https://docs.rs/caches [Caching strategies to improve disk system performance]: https://dl.acm.org/doi/10.1109/2.268884 [go-tinylfu]: https://github.com/dgryski/go-tinylfu [Dgraph's ristretto]: https://github.com/dgraph-io/ristretto/blob/master/policy.go [TinyLFU: A Highly Efficient Cache Admission Policy]: https://arxiv.org/pdf/1512.00727.pdf [`examples`]: https://github.com/al8n/caches-rs/tree/main/examples