Redis CLI.
sh
git clone https://github.com/iorust/redis-cli.git && cd redis-cli && cargo build --release
sh
target/release/redis-cli -h 127.0.0.1 -p 6379
More help:
sh
target/release/redis-cli --help
rust
extern crate redis_cli;
// exports:
use redis_cli::{create_client, Client, COMMANDS, Value, encode_slice, Decoder};
Re-exports from the https://github.com/iorust/resp
fn create_client(hostname: &str, port: u16, password: &str, db: u16) -> io::Result<Client>
Rust
let mut client = create_client("127.0.0.1", 6379, "", 0).expect("Failed to connect");
client.cmd(&["set", "test", "hello!"]).unwrap();
Rust
struct Client {
// some fields omitted
}
fn new<A: ToSocketAddrs>(addrs: A) -> Self
Rust
let mut client = Client::new((hostname, port));
fn cmd(&mut self, slice: &[&str]) -> Result<Value>
Rust
client.cmd(&["sget", "test"]).unwrap(); // Value::String("hello!")
Pub/Sub
, Cluster
, monitor
are not available currently.