SparKV is an expirable in-memory key-value store for Rust.
- Flexible expiration duration (a.k.a. time-to-live or TTL) per entry instead of database-wide common TTL.
- This is similar to that of DNS where each entries of the same domain can have its own unique TTL.
- Automatically clears expired entries by default.
- String-based key-value store.
- Fast data entry enforcements, including ensuring entry size, database size and max TTL.
- SparKV is intentionally not an LRU cache.
- Configurable.
Add SparKV crate to your Cargo dependencies:
Quick start
use sparkv::SparKV;letmut sparkv =SparKV::new();sparkv.set("your-key","your-value");// writelet value = sparkv.get("your-key").unwrap();// read// Write with unique TTLsparkv.set_with_ttl("diff-ttl","your-value", std::time::Duration::from_secs(60));
Seeconfig.rs
for more configuration options.
- Documentations
- Support generic data types
MIT License
Copyright © 2024 U-Zyn Chua