Crate simple_redis [−] [src]
simple_redis
Simple redis client based on redis-rs with internal connection handling.
This library provides a very basic, simple API for the most common redis operations.
While not as comprehensive or flexiable as redis-rs,
it does provide a simpler api for most common use cases and operations as well as automatic internal connection
handling.
Connection validation is done before every operation invocation, so there is no need to create/release or validate
connections before running any Redis operation.
However, this comes at a small performance cost of PING operation to the redis server.
Examples
extern crate simple_redis; fn main() { match simple_redis::create("redis://127.0.0.1:6379/") { Ok(mut client) => { println!("Created Redis Client"); match client.set("my_key", "my_value") { Err(error) => println!("Unable to set value in Redis: {}", error), _ => println!("Value set in Redis") } match client.get("my_key") { Ok(value) => println!("Read value from Redis: {}", value), Err(error) => println!("Unable to get value from Redis: {}", error) } /// run some command that is not built in the library match client.run_command::<String>("ECHO", vec!["testing"]) { Ok(value) => assert_eq!(value, "testing"), _ => panic!("test error"), } }, Err(error) => println!("Unable to create Redis client: {}", error) } }
Modules
client |
Functions
create |
Constructs a new redis client. |
Type Definitions
RedisEmptyResult |
Holds empty result or error |
RedisError |
Redis Error struct |
RedisResult |
Redis result which either holds a value or a Redis error |
RedisStringResult |
Holds string result or error |