Expand description
§OxidArt
A high-performance, compressed Adaptive Radix Tree (ART) implementation in Rust for fast key-value storage operations.
§Features
- O(k) operations: All operations (get, set, del) run in O(k) time where k is the key length
- Path compression: Minimizes memory usage by compressing single-child paths
- Prefix operations: Supports
getnanddelnfor prefix-based queries and deletions - Zero-copy values: Uses
bytes::Bytesfor efficient value handling
§Example
ⓘ
use oxidart::OxidArt;
use bytes::Bytes;
use std::time::Duration;
let mut tree = OxidArt::new();
// Insert key-value pairs
tree.set(Bytes::from_static(b"hello"), Bytes::from_static(b"world"));
// Insert with TTL (requires `ttl` feature, enabled by default)
tree.set_now(1700000000); // Update internal clock
tree.set_ttl(Bytes::from_static(b"session"), Duration::from_secs(3600), Bytes::from_static(b"data"));
// Retrieve a value
assert_eq!(tree.get(Bytes::from_static(b"hello")), Some(Bytes::from_static(b"world")));
// Get all entries with a prefix
let entries = tree.getn(Bytes::from_static(b"hello"));
// Delete a key
let deleted = tree.del(Bytes::from_static(b"hello"));
// Delete all keys with a prefix
let count = tree.deln(Bytes::from_static(b"hello"));§Key Requirements
Keys must be valid ASCII bytes. Non-ASCII keys will trigger a debug assertion.
Modules§
Structs§
- OxidArt
- A compressed Adaptive Radix Tree for fast key-value storage.
Enums§
- TtlResult
- Result of a TTL lookup operation.