[][src]Crate darkredis

Asyncronous redis client built using futures and async await, with optional connection pooling.

#![feature(async_await)]
use darkredis::*;

// Create a connection pool with 4 connections
let pool = ConnectionPool::create("127.0.0.1:6379".into(), None, 4).await.unwrap();
let mut connection = pool.get().await; // Grab a connection from the pool

connection.set("some-key", "Hello, world!").await.unwrap();
assert_eq!(connection.get("some-key").await.unwrap(), Some("Hello, world!".into()));

Structs

Command

A struct for defining commands manually. If you want pipelining, use CommandList.

CommandList

A struct for defining commands manually, which allows for pipelining of several commands. If you need to only run one command, use Command, which has almost the same API.

Connection

A connection to Redis. Copying is cheap as the inner type is a simple, futures-aware, Arc<Mutex>, and will not create a new connection. Use a ConnectionPool if you want to use pooled conections. Every convenience function can work with any kind of data as long as it can be converted into bytes.

ConnectionPool

A connection pool. Clones are cheap and is the expected way to send the pool around your application.

Enums

Error

The darkredis error type.

Value

Enum depicting the various possible responses one can get from Redis.

Type Definitions

Result

Result type used in the whole crate.