65 releases (29 stable)

new 6.0.0 Mar 19, 2023
6.0.0-beta.2 Dec 12, 2022
5.2.0 Sep 1, 2022
5.1.0 Jun 13, 2022
0.0.6 Nov 7, 2017

#25 in Database interfaces

Download history 1565/week @ 2022-12-02 2118/week @ 2022-12-09 1609/week @ 2022-12-16 634/week @ 2022-12-23 747/week @ 2022-12-30 1289/week @ 2023-01-06 1291/week @ 2023-01-13 1630/week @ 2023-01-20 1472/week @ 2023-01-27 1421/week @ 2023-02-03 2184/week @ 2023-02-10 1104/week @ 2023-02-17 1463/week @ 2023-02-24 1577/week @ 2023-03-03 2158/week @ 2023-03-10 2604/week @ 2023-03-17

7,904 downloads per month
Used in 8 crates (7 directly)

MIT license

27K SLoC


License License CircleCI Crates.io API docs

An async Redis client for Rust.


use fred::prelude::*;

async fn main() -> Result<(), RedisError> {
  let config = RedisConfig::default();
  let perf = PerformanceConfig::default();
  let policy = ReconnectPolicy::default();
  let client = RedisClient::new(config, perf, Some(policy));
  // connect to the server, returning a handle to the task that drives the connection
  let _ = client.connect();
  let _ = client.wait_for_connect().await?;
  // convert responses to many common Rust types
  let foo: Option<String> = client.get("foo").await?;
  let _: () = client.set("foo", "bar", None, None, false).await?;
  // or use turbofish to declare response types
  println!("Foo: {:?}", client.get<String, _>("foo").await?);
  // or use a lower level interface for responses to defer parsing, etc
  let foo: RedisValue = client.get("foo").await?;
  assert_eq!(foo.as_str().unwrap(), "bar");
  let _ = client.quit().await?;

See the examples for more.


  • Supports RESP2 and RESP3 protocol modes.
  • Supports clustered, centralized, and sentinel Redis deployments.
  • Optional built-in reconnection logic with multiple backoff policies.
  • Publish-Subscribe and keyspace events interfaces.
  • Supports transactions.
  • Supports Lua scripts.
  • Supports streaming results from the MONITOR command.
  • Supports custom commands provided by third party modules.
  • Supports TLS connections via native-tls and/or rustls.
  • Supports streaming interfaces for scanning functions.
  • Supports pipelining.
  • Automatically retry requests under bad network conditions.
  • Optional built-in tracking for network latency and payload size metrics.
  • An optional client pooling interface to round-robin requests among a pool of clients.
  • An optional sentinel client for interacting directly with sentinel nodes to manually fail over servers, etc.
  • An optional pubsub subscriber client that will automatically manage channel subscriptions.
  • An optional interface to override DNS resolution logic.
  • Optional support for JSON values.

Build Time Features

Name Default Description
enable-native-tls Enable TLS support via native-tls.
enable-rustls Enable TLS support via rustls.
vendored-openssl Enable the native-tls/vendored feature, if possible.
ignore-auth-error x Ignore auth errors that occur when a password is supplied but not required.
metrics Enable the metrics interface to track overall latency, network latency, and request/response sizes.
reconnect-on-auth-error A NOAUTH error is treated the same as a general connection failure and the client will reconnect based on the reconnection policy. This is recommended if callers are using ElastiCache.
pool-prefer-active x Prefer connected clients over clients in a disconnected state when using the RedisPool interface.
full-tracing Enable full tracing support. This can emit a lot of data.
partial-tracing Enable partial tracing support, only emitting traces for top level commands and network latency.
blocking-encoding Use a blocking task for encoding or decoding frames. This can be useful for clients that send or receive large payloads, but will only work when used with a multi-thread Tokio runtime.
network-logs Enable TRACE level logging statements that will print out all data sent to or received from the server. These are the only logging statements that can ever contain potentially sensitive user data.
custom-reconnect-errors Enable an interface for callers to customize the types of errors that should automatically trigger reconnection logic.
monitor Enable an interface for running the MONITOR command.
sentinel-client Enable an interface for communicating directly with Sentinel nodes. This is not necessary to use normal Redis clients behind a sentinel layer.
sentinel-auth Enable an interface for using different authentication credentials to sentinel nodes.
subscriber-client Enable an optional subscriber client that manages channel subscription state for callers.
serde-json Enable an interface to automatically convert Redis types to JSON.
no-client-setname Disable the automatic CLIENT SETNAME command used to associate server logs with client logs.
mocks Enable a mocking layer interface that can be used to intercept and process commands in tests.
dns Enable an interface that allows callers to override the DNS lookup logic.
check-unresponsive Enable additional monitoring to detect unresponsive connections.
replicas (Beta) Enable an interface that routes commands to replica nodes.


~400K SLoC