| Crates.io | dicedb-rs |
| lib.rs | dicedb-rs |
| version | 0.1.5 |
| created_at | 2025-03-16 23:06:13.366572+00 |
| updated_at | 2025-03-24 16:59:39.247985+00 |
| description | Rust SDK for DiceDb. |
| homepage | |
| repository | https://github.com/DanielHauge/dicedb-rs |
| max_upload_size | |
| id | 1594848 |
| size | 141,292 |
DiceDB is an open-source, fast, reactive, in-memory database optimized for modern hardware. The source code for DiceDB can be found in the DiceDB Github repository.
[!WARNING] This SDK project is under active development without any stable API yet. A base implementation is made to support all operations of DiceDB.
DiceDB must be running to use the SDK, read more at the DiceDB Getting Started.
A local container can be started with:
docker run -p 7379:7379 dicedb/dicedb
Add the SDK as depedency to your Rust project.
cargo add dicedb-rs
A Simple examples of how to use the sdk:
fn main() -> Result<(), client::ClientError> {
// Create a new client
let mut client = Client::new("localhost".to_string(), 7379)?;
// Set a key
client.set("Hello", "World")?;
// Get a key
let value = client.get("Hello")?;
println!("Hello: {}", value);
// Subscribe to changes in the Hello key
let (hello_changes, _) = client.get_watch("Hello")?;
// Listen for changes
for change in hello_changes {
eprintln!("There was a change: {:?}", change);
}
Ok(())
}
More examples of programs using the SDK can be found in the examples.
To contribute and develop the SDK, the following pre-requisites are needed to build and test the project:
Clone the repository and remember to checkout the protos submodule.
Build with:
cargo build
Run tests with:
cargo test
Run benchmarks with:
cargo bench