Skip to content

pelikan-io/cache-rs

Repository files navigation

cache-rs

Rust implementations of cache storage engines from Pelikan.

Crates

Crate Description
segcache Segment-structured cache engine with pluggable eviction policies
cuckoo-cache Array-based cuckoo hash cache with fixed-size item slots
keyvalue Shared packed item types (Value, RawItem, TinyItem)
datatier Byte storage pool abstraction (anonymous mmap, file-backed mmap, hybrid)

See design for architecture details and eviction policy comparison.

Quick Start

use segcache::{Policy, Segcache};
use std::time::Duration;

const MB: usize = 1024 * 1024;

let mut cache = Segcache::builder()
    .heap_size(64 * MB)
    .segment_size(1 * MB as i32)
    .hash_power(16)
    .eviction(Policy::S3Fifo { admission_ratio: 0.10 })
    .build()
    .expect("failed to create cache");

cache.insert(b"key", b"value", None, Duration::from_secs(300))?;
let item = cache.get(b"key").expect("not found");
assert_eq!(item.value(), b"value");
cache.delete(b"key");

Building

cargo build --workspace
cargo test --workspace

License

MIT OR Apache-2.0

About

A collection of Rust implementation of state-of-the-art cache algorithms

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages