From 4d5a19d0546db13be6a23925f944080dab55afb4 Mon Sep 17 00:00:00 2001 From: Lapin Raving Date: Thu, 1 Jun 2023 23:47:38 +0200 Subject: [PATCH] feat: ading example to push redis value --- .gitignore | 1 + examples/simple_client.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .gitignore create mode 100644 examples/simple_client.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target diff --git a/examples/simple_client.rs b/examples/simple_client.rs new file mode 100644 index 0000000..54880d2 --- /dev/null +++ b/examples/simple_client.rs @@ -0,0 +1,21 @@ +use redis::{ + //RedisResult, + Client, + Commands, + Connection, +}; + +fn do_something() -> redis::RedisResult<()> { + let client = Client::open("redis://127.0.0.1/")?; + let mut con: Connection = client.get_connection()?; + + /* do something here */ + //let val : String = con.get("/pl/0/0")?; + let _ = con.set("/pl/0/0", "[(150.0, 230.0, 65280), (170.0, 170.0, 65280), (230.0, 170.0, 65280), (210.0, 230.0, 65280), (150.0, 230.0, 65280)]")?; + + Ok(()) +} + +fn main() { + do_something(); +}