sparkv

Crates.iosparkv
lib.rssparkv
version0.1.1
sourcesrc
created_at2024-05-07 08:02:48.514279
updated_at2024-05-07 10:06:02.156543
descriptionExpirable in-memory key-value store
homepagehttps://crates.io/crates/sparkv
repositoryhttps://github.com/uzyn/sparkv
max_upload_size
id1231943
size20,724
U-Zyn Chua (uzyn)

documentation

README

SparKV

SparKV is an expirable in-memory key-value store for Rust.

Features

  1. Flexible expiration duration (a.k.a. time-to-live or TTL) per entry instead of database-wide common TTL.
    1. This is similar to that of DNS where each entries of the same domain can have its own unique TTL.
  2. Automatically clears expired entries by default.
  3. String-based key-value store.
  4. Fast data entry enforcements, including ensuring entry size, database size and max TTL.
  5. SparKV is intentionally not an LRU cache.
  6. Configurable.

Usage

Add SparKV crate to your Cargo dependencies:

$ cargo add sparkv

Quick start

use sparkv::SparKV;

let mut sparkv = SparKV::new();
sparkv.set("your-key", "your-value"); // write
sparkv.get("your-key", "your-value"); // read

// Set with unique TTL
sparkv.set_with_ttl("longer", "your-value", std::time::Duration::from_secs(60));

See config.rs for more configuration options.

TODO

  1. Documentations
  2. Support generic data types

License

MIT License
Copyright © 2024 U-Zyn Chua

Commit count: 16

cargo fmt