Expand description
Asyncronous redis client built using futures and async await, with optional connection pooling.
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
- Struct for defining commands manually. If you want to run multiple commands in a pipeline, use
CommandList
. - Command
List - 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 aConnectionPool
if you want to use pooled connections. Alternatively, there’s thedeadpool-darkredis
crate. Every convenience function can work with any kind of data as long as it can be converted into bytes. Check the Redis command reference for in-depth explanations of each command. - Connection
Pool - A connection pool. Clones are cheap and is the expected way to send the pool around your application.
- HScan
Builder - Builder to build a HSCAN command. Borrows all its data.
- HScan
Stream - A Stream of results from running HSCAN. The same key might appear multiple times, and polling until the stream is empty will return all matching fields and values in the hash set.
- MSet
Builder - A builder struct for commands where you set multiple values at once. It utilizes references to ensure that it does not copy any of the data given to it. It supports the classic builder-pattern, as well as a mutable pattern.
- Message
- A message received from a channel.
- Message
Stream - A stream of
Message
s. - PMessage
- A message received from a channel (Pattern version)
- PMessage
Stream - A stream of
PMessage
s. SeeMessageStream
for more info. - Response
Stream - A stream of responses from a pipelined command.
- Scan
Builder - Builder to build a SCAN or SSCAN command. Borrows all its data.
- Scan
Stream - A Stream of results from running SCAN or SSCAN. The same value might appear multiple times. Polling until the stream is empty will return all matched elements.
Enums§
- Data
Type - An enum corresponding to every Redis type.
- Error
- The
darkredis
error type. - Value
- Enum depicting the various possible responses one can get from Redis.
Traits§
- ToSocket
Addrs - Converts or resolves without blocking to one or more
SocketAddr
values.
Type Aliases§
- Result
- Result type used in the whole crate.