21 releases (8 breaking)

0.9.0 Mar 24, 2021
0.7.2 Mar 9, 2021

#2114 in Database interfaces

Download history 42/week @ 2024-11-13 36/week @ 2024-11-20 29/week @ 2024-11-27 60/week @ 2024-12-04 109/week @ 2024-12-11 55/week @ 2024-12-18 9/week @ 2024-12-25 25/week @ 2025-01-01 64/week @ 2025-01-08 44/week @ 2025-01-15 13/week @ 2025-01-22 25/week @ 2025-01-29 43/week @ 2025-02-05 74/week @ 2025-02-12 59/week @ 2025-02-19 39/week @ 2025-02-26

224 downloads per month

MIT license

19KB
436 lines

RedisRS

Simple rust lib to communicate with Redis.


lib.rs:

RedisRs

A simple redis client library This library revolves around the Connection struct. Every request is sent via Connection methods. Requests can also be sent using the send_raw_request function. Examples Create a connection and send requests

 extern crate redis_rs;
 use std::net::TcpStream;
 use redis_rs::connection::Connection;
 use redis_rs::response::RedisResponse;

 let host = "127.0.0.1";
 let port = 6379;
 let addr = format!("{}:{}", host, port);
 let stream = TcpStream::connect(addr).unwrap();

 // stream can be anything that implements read and write
 let mut client = Connection::new(host, port, stream);

 // send a request
 let _ = client.send_raw_request("SET FOO BAR");
 // or use a supported command
 let response = client.get("FOO").unwrap();

 // match against the response to extract the value
 if let RedisResponse::BulkString(value) = response {
   println!("{}", value);
 }

No runtime deps