Crate fred [] [src]

Fred

A client library for Redis based on Futures and Tokio.

extern crate fred;
extern crate tokio_core;

use tokio_core::reactor::Core;

use fred::RedisClient;
use fred::types::{
  RedisConfig,
  RedisValue,
  InfoKind
};

fn main() {
  let config = RedisConfig::default();
  let mut core = Core::new().unwrap();
  let handle = core.handle();

  let client = RedisClient::new(config);
  let connection_ft = client.connect(&handle);

  let commands_ft = client.on_connect().and_then(|client| {
    client.select(0)
  })
  .and_then(|client| {
    client.info(Some(InfoKind::All))
  })
  .and_then(|(client, info)| {
    println!("Server info: {:?}", info);
    client.quit()
  });

  let (err, client) = core.run(connection_ft.join(commands_ft)).unwrap();

  if let Some(err) = err {
    println!("Client closed with error: {:?}", err);
  }
}

Modules

error

Error handling.

sync

Send and Sync wrappers for the client.

types

Configuration options, return value types, etc.

Structs

RedisClient

A Redis client.