Redis client in Rust
The crate is called "redis-client".
``` rust extern crate redis_client;
use redisclient::commands::CommandSender; use redisclient::errors::RedisError;
fn setandget() -> Result
```
``` rust extern crate redis_client;
use redisclient::commands::{CommandBuilder, CommandSender}; use redisclient::errors::RedisError;
fn pipeline() -> Result
```
``` rust extern crate redis_client;
use redisclient::commands::CommandSenderAsync; use redisclient::errors::RedisError;
fn asyncget() -> Result<(), RedisError> {
let mut asyncclient = try!(redisclient::RedisClientAsync::new("localhost", "6379"));
// the result argument in the closure is a Result
try!(async_client.get("key2", |result| {
let result_value: String = match result {
Ok(value) => value.into(),
Err(err) => err.to_string(),
};
println!("{:?}", result_value);
}));
loop {
sleep(Duration::new(0, 1000 * 1000 * 1000));
// this method will call callbacks when their command executions are over.
async_client.pump();
}
Ok(())
}
```
Copyright (c) 2016 Gautier TANGUY
MIT License