https://github.com/uzyn/sparkv
Expirable in-memory key-value store for Rust with no dependencies
https://github.com/uzyn/sparkv
in-memory-database kv-store no-dependencies no-deps rust rust-lang ttl
Last synced: about 1 month ago
JSON representation
Expirable in-memory key-value store for Rust with no dependencies
- Host: GitHub
- URL: https://github.com/uzyn/sparkv
- Owner: uzyn
- License: mit
- Created: 2024-05-07T04:56:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-09T10:24:28.000Z (over 1 year ago)
- Last Synced: 2025-04-10T03:48:14.625Z (6 months ago)
- Topics: in-memory-database, kv-store, no-dependencies, no-deps, rust, rust-lang, ttl
- Language: Rust
- Homepage: https://crates.io/crates/sparkv
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```sh
$ cargo add sparkv
```Quick start
```rust
use sparkv::SparKV;let mut sparkv = SparKV::new();
sparkv.set("your-key", "your-value"); // write
let value = sparkv.get("your-key").unwrap(); // read// Write with unique TTL
sparkv.set_with_ttl("diff-ttl", "your-value", std::time::Duration::from_secs(60));
```See `config.rs` for more configuration options.
## TODO
1. Documentations
1. Support generic data types## License
MIT License
Copyright © 2024 U-Zyn Chua