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

Overview

Caches

github Build codecov

docs.rs crates.io license-apache license-mit

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.2.0" 
  • no_std
    [dependencies]
    caches = {version: "0.2.0", features: ["core"]}

Usages

Please see examples.

Roadmap

  • 0.2: Support TinyLFU, SampledLFU, WTinyLFUCache
  • 0.3: Support LIRS, DLIRS, DSLRU
  • 0.4: Add ttl feature

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.
You might also like...
IDX is a Rust crate for working with RuneScape .idx-format caches.
IDX is a Rust crate for working with RuneScape .idx-format caches.

This image proudly made in GIMP License Licensed under GNU GPL, Version 3.0, (LICENSE-GPL3 or https://choosealicense.com/licenses/gpl-3.0/) Contributi

Reading Getting Friendly With CPU Caches
Reading Getting Friendly With CPU Caches

Getting Friendly With CPU Caches Reading Getting Friendly With CPU Caches, by Miki Tebeka and William Kennedy, inspired me to look at some Rust equiva

Rust no_std, embedded_hal board support package for the Electro-Smith Daisy platform.

Daisy Rust no_std, embedded_hal board support package for the Electro-Smith Daisy platform. This project was forked from antoinevg/daisy_bsp. Supporte

How to bootstrap support for a no_std target

The Embedonomicon How to bootstrap support for a no_std target This book is hosted at https://docs.rust-embedded.org/embedonomicon/ This project is de

A rust implementation of some popular snowball stemming algorithms

Rust Stemmers This crate implements some stemmer algorithms found in the snowball project which are compiled to rust using the rust-backend of the sno

Forked rust translation of the popular dump1090 project for adsb demodulation

Forked rust translation of the popular dump1090 project for adsb demodulation

A rust program to bruteforce ZIP, PDF and some popular hashes.

Veldora A program to bruteforce zips, pdfs and some popular hashes. This is basically a rust version of bruttle, but a lot faster. Installation: git c

An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client.
An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client.

Four in a Row - Server An online version of the popular game four in a row, written in Rust on the server side and Flutter + Dart on the client. Downl

A solver for the popular Wordle game written in Rust.

Wordle Solver A solver for the popular Wordle game written in Rust. It does not attempt to be the most efficient solver possible but tries to avoid us

A rust-based version of the popular dnsgen python utility

ripgen A rust-based version of the popular dnsgen python utility. ripgen is split into two main parts: ripgen: A CLI utility that calls into ripgen_li

Rust flavor of the popular cron scheduler croner.

Croner Croner is a fully featured, lightweight, efficient Rust library for parsing and evaluating cron patterns. Designed with simplicity and performa

Yet Another Kalman Filter Implementation. As well as Lie Theory (Lie group and algebra) on SE(3). [no_std] is supported by default.

yakf - Yet Another Kalman Filter Yet Another Kalman Filter Implementation, as well as, Lie Theory (Lie group, algebra, vector) on SO(3), SE(3), SO(2),

Hotwire allows you to study network traffic of a few popular protocols in a simple way
Hotwire allows you to study network traffic of a few popular protocols in a simple way

Hotwire Hotwire is a gtk GUI application that leverages the wireshark and tshark infrastructure to capture traffic and explore the contents of tcpdump

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes.
Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes.

lutgen-rs A blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes. Theme any image to your dekstop colorsc

Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

A feature-few, no-allocation JSON parser in `no_std` rust.

Small JSON Parser in no_std This library reads and parses JSON strings. Its intended use case is to read a JSON payload once. It does not serialise da

Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

Rust I/O for no_std

acid_io A pared-down version of Rust's std::io usable in no_std contexts. Rust's std::io provides common interfaces that are used widely in the Rust e

Comments
  • fix: Make the core feature work

    fix: Make the core feature work

    Updating the support for the core feature to compile and be compatible on the API.

    Also deletes some unused fields and methods the compiler was complaining about and cargo-fmt made some changes to the edited files.

    We don't particularly need the core feature, however it is the only way to use the crate without depending on default features of the chrono crate. And the chrono crate has a dependency on a vulnerable version of the time crate. Switching to the core feature for this crate allows us to avoid having the vulnerability in our dependencies.

    opened by flub 2
  • Hidden KeyRef type complicates key lookup

    Hidden KeyRef type complicates key lookup

    Because keys are stored inside a KeyRef type, .get() can be complicated or inefficient. For instance, if I have a cache which stores the key as a Vec<u8>, I'd expect to be able to lookup a value a in the cache using a &[u8], but that's not possible:

    error[E0277]: the trait bound `KeyRef<Vec<u8>>: Borrow<[u8]>` is not satisfied
      --> native/lib.rs:98:17
       |
    98 |     match cache.get(key.as_slice()) {
       |                 ^^^ the trait `Borrow<[u8]>` is not implemented for `KeyRef<Vec<u8>>`
       |
       = help: the following implementations were found:
                 <KeyRef<K> as Borrow<K>>
    
    opened by JayKickliter 1
Releases(caches-0.2.0)
Owner
Al Liu
Rustacean/Gopher, distributed system engineer. In the previous two years, writing Go, but now, writing Rust most of the time.
Al Liu
Stretto is a Rust implementation for ristretto. A high performance memory-bound Rust cache.

Stretto is a Rust implementation for ristretto. A high performance memory-bound Rust cache.

Al Liu 310 Dec 29, 2022
Rust binary memcached implementation

bmemcached-rs Rust binary memcached implementation (ON GOING) Usage extern crate bmemcached; use std::sync::Arc; use std::thread; use bmemcached::Me

Jayson Reis 25 Jun 15, 2022
This is a Rust implementation for HashiCorp's golang-lru. This crate contains three LRU based cache, LRUCache, TwoQueueCache and AdaptiveCache.

This is a Rust implementation for HashiCorp's golang-lru. This crate contains three LRU based cache, LRUCache, TwoQueueCache and AdaptiveCache.

Al Liu 84 Jan 3, 2023
A generational arena based LRU Cache implementation in 100% safe rust.

generational-lru Crate providing a 100% safe, generational arena based LRU cache implementation. use generational_lru::lrucache::{LRUCache, CacheError

Arindam Das 37 Dec 21, 2022
A native stateless cache implementation.

fBNC fBNC, Blockchain Native Cache. A native stateless storage library for block chain. Its value is to improve the stability and security of online s

Findora Foundation 1 Jan 12, 2022
Rust cache structures and easy function memoization

cached Caching structures and simplified function memoization cached provides implementations of several caching structures as well as a handy macro f

James Kominick 996 Jan 7, 2023
memcache client for rust

rust-memcache rust-memcache is a memcached client written in pure rust. Install The crate is called memcache and you can depend on it via cargo: [depe

An Long 104 Dec 23, 2022
A set of safe Least Recently Used (LRU) map/cache types for Rust

LruMap A set of safe Least-Recently-Used (LRU) cache types aimed at providing flexible map-like structures that automatically evict the least recently

Khonsu Labs 4 Sep 24, 2022
Rust type wrapper to cache hash of potentially large structures.

CachedHash For a type T, CachedHash<T> wraps T and implements Hash in a way that caches T's hash value. This is useful when T is expensive to hash (fo

pali 3 Dec 8, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022