Stretto is a high performance in-memory caching system.
In your cargo project add the following
[dependencies]
warp = { git = "https://github.com/Satellite-im/Warp" }
warp-extensions = { git = "https://github.com/Satellite-im/Warp", features = ["pd_stretto"] }
use warp::pocket_dimension::PocketDimension;
use warp_extensions::pd_stretto::StrettoClient;
let mut system = StrettoClient::new()?;
TODO
use warp::pocket_dimension::PocketDimension;
use warp_extensions::pd_stretto::StrettoClient;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
struct Instruction {
pub instr_type: u8,
pub message: String
}
let data = DataObject::new(DataType::Unknown, Instruction { instr_type: 1, message: "PING".into() })?;
system.add_data(DataType::Unknown, &data)?;
TODO
use warp::pocket_dimension::PocketDimension;
use warp_extensions::pd_stretto::StrettoClient;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
struct Instruction {
pub instr_type: u8,
pub message: String
}
let mut query = QueryBuilder::default();
query.where("instr_type", 1)?;
let objects = system.get_data(DataType::Unknown, Some(&query))?;
let object = objects.last().unwrap();
let instruction = object.payload::<Instruction>()?;
assert_eq!(instruction.instr_type, 1);
assert_eq!(instruction.message, String::from("PING"));