redis-cli

Crates.ioredis-cli
lib.rsredis-cli
version0.3.1
sourcesrc
created_at2016-02-14 14:41:47.257474
updated_at2016-06-04 04:24:11.557887
descriptionRedis CLI.
homepagehttps://github.com/iorust/redis-cli
repositoryhttps://github.com/iorust/redis-cli.git
max_upload_size
id4177
size32,675
0xZensh (zensh)

documentation

https://github.com/iorust/redis-cli

README

redis-cli

Redis CLI.

Crates version Build Status Coverage Status Crates downloads

Build

git clone https://github.com/iorust/redis-cli.git && cd redis-cli && cargo build --release

Run

target/release/redis-cli -h 127.0.0.1 -p 6379

More help:

target/release/redis-cli --help

Use as a crate

extern crate redis_cli;
// exports:
use redis_cli::{create_client, Client, COMMANDS, Value, encode_slice, Decoder};

Value, encode_slice, Decoder

Re-exports from the https://github.com/iorust/resp

fn create_client(host: &str, port: u16, password: &str, db: u16) -> io::Result<Client>

let mut client = create_client("127.0.0.1", 6379, "", 0).expect("Failed to connect");
client.cmd(&["set", "test", "hello!"]).unwrap();

Client

struct Client {
    // some fields omitted
}

impl Client

fn new<A: ToSocketAddrs>(addrs: A) -> io::Result<Client>
let mut client = Client::new((hostname, port));
fn cmd(&mut self, slice: &[&str]) -> Result<Value>
client.cmd(&["get", "test"]).unwrap(); // Value::String("hello!")
fn read_more(&mut self) -> Result<Value>

Some commands will have one more replies. This method use to read them.

client.read_more().unwrap();

COMMANDS

https://github.com/iorust/redis-cli/blob/master/src/command.rs

Commit count: 14

cargo fmt