#lru-cache #cache #lru #tinylfu

no-std caches

This is a Rust implementation for popular caches (support no_std)

13 releases

new 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

#114 in Data structures

Download history 624/week @ 2024-09-22 566/week @ 2024-09-29 1561/week @ 2024-10-06 1067/week @ 2024-10-13 1080/week @ 2024-10-20 668/week @ 2024-10-27 1146/week @ 2024-11-03 715/week @ 2024-11-10 736/week @ 2024-11-17 641/week @ 2024-11-24 838/week @ 2024-12-01 958/week @ 2024-12-08 930/week @ 2024-12-15 308/week @ 2024-12-22 618/week @ 2024-12-29 1163/week @ 2025-01-05

3,043 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

355KB
5.5K SLoC

Caches

github Build LoC codecov

docs.rs crates.io crates.io

license

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, TwoQueueCache and AdaptiveCache.
  • LFU
    • TinyLFU, SampledLFU, and WTinyLFUCache

Installation

  • std

    [dependencies]
    caches = "0.3" 
    
  • no_std

    [dependencies]
    caches = { version = "0.3", default-features = false, features = ["libm", "hashbrown"] }
    

Usages

Please see examples.

If you want a high-performance thread-safe modern cache, please see https://crates.io/crates/stretto

Acknowledgments

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
~35K SLoC