Crates.io | redispatch |
lib.rs | redispatch |
version | 0.0.2 |
source | src |
created_at | 2023-05-09 11:45:57.289634 |
updated_at | 2023-05-09 14:54:15.259524 |
description | serialization and deserialization for redis |
homepage | |
repository | https://github.com/Kilerd/redispatch |
max_upload_size | |
id | 860427 |
size | 3,357 |
best serialization patch for redis
add dependencies
# Cargo.toml
redis = { version = "0.23.0", features = ["aio", "tokio-comp"] }
redispatch = "0.0.1"
import redispatch::JsonSerdeCommands
to use
use futures::prelude::*;
use redispatch::JsonSerdeCommands;
use serde::{Serialize, de::DeserializeOwned};
#[derive(Debug, DeserializeOwned)]
struct MyData {
username: String
}
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let mut con = client.get_async_connection().await?;
let serde_ret = con.get::<MyData>("mydata").await?;