| Crates.io | kade |
| lib.rs | kade |
| version | 0.0.1 |
| created_at | 2025-01-17 23:37:24.629206+00 |
| updated_at | 2025-01-17 23:37:24.629206+00 |
| description | High-performance queue pipeline and key-value store |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1521181 |
| size | 41,011 |
Cross-platform high-performance queue pipeline and key-value store
Previously, tools like:
Kade attempts to solve these problems:
Here's a simple example demonstrating basic key-value operations:
use kade::prelude::*;
#[tokio::main]
pub async fn main() -> Result<()> {
let mut client = Client::connect(&format!("127.0.0.1:{}", DEFAULT_PORT)).await?;
// set a value
client.set("cat", "meow".into()).await?;
// get the value
let result = client.get("cat").await?;
println!("Value: {:?}", result);
Ok(())
}
Start the Kade server using the provided binary:
# optional storage dir
kade-server --state cached-data.kade
Server options:
--port: Server port (default: 6379)--host: Bind address (default: 127.0.0.1)--state: Path to save/load database state--no-cache: Disable state save on shutdown-v: Increase logging verbosity-q: Decrease logging verbosityKade comes with an interface (kade-cli) for interacting with the server:
Example commands:
> set mykey myvalue
OK
> get mykey
"myvalue"
> set mykey "expires soon" 5000
OK
> publish news "Breaking news!"
Publish OK
GET key: Retrieve the value of a keySET key value [expiration]: Set a key with optional expiration in millisecondsPUBLISH channel message: Send a message to a channelSUBSCRIBE channel [channel...]: Subscribe to one or more channelsUNSUBSCRIBE [channel...]: Unsubscribe from channelsDUMP [filename]: Save the current database state to a fileLOAD [filename]: Load database state from a fileKade provides multiple client implementations:
Client):let mut client = Client::connect("127.0.0.1:6379").await?;
BlockingClient):let mut client = BlockingClient::connect("127.0.0.1:6379")?;
BufferedClient):let client = Client::connect("127.0.0.1:6379").await?;
let mut buffered = BufferedClient::buffer(client);
More will be added for other languages soon.
Kade is built with a modular architecture:
kade: Main crate containing the client and server binarieskade-proto: Protocol implementation and client librarieskade-server: Server implementationThe server uses Tokio for async I/O and supports graceful shutdown with state preservation.