Crates.io | redis-ac |
lib.rs | redis-ac |
version | 0.1.1 |
source | src |
created_at | 2019-11-16 02:22:38.371968 |
updated_at | 2019-11-23 00:32:36.703975 |
description | Asynchronuos commands helper for redis-rs |
homepage | https://github.com/yushiomote/redis-ac |
repository | https://github.com/yushiomote/redis-ac |
max_upload_size | |
id | 181691 |
size | 57,765 |
Asynchronous version of redis::Commands
trait.
use futures::prelude::*;
use redis_ac::Commands;
fn main() {
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let f = client
.get_async_connection()
.and_then(|con| {
con.set("key", "value")
.and_then(|(con, s): (_, String)| {
assert_eq!(s, "OK");
con.get("key")
})
.map(|(_, s): (_, String)| {
assert_eq!(s, "value");
})
})
.map_err(|e| panic!("{}", e));
tokio::run(f);
}
use futures::prelude::*;
use redis_ac::Commands;
fn main() {
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let f = client
.get_shared_async_connection()
.and_then(|con| {
con.scan_match("key*")
.map(|(_, v): (_, String)| v)
.collect()
})
.map(|res| {
println!("{:?}", res);
})
.map_err(|e| panic!("{}", e));
tokio::run(f);
}