Module redis

Module redis 

Source
Expand description

The session backend using Redis.

§Example

#[macro_use]
extern crate finchers;
extern crate finchers_session;

use finchers::prelude::*;
use finchers_session::Session;
use finchers_session::redis::{
    Client,
    RedisBackend,
    RedisSession,
};
use std::time::Duration;

let client = Client::open("redis://127.0.0.1/").unwrap();
let backend = RedisBackend::new(client)
    .key_prefix("my-app-name")
    .cookie_name("sid")
    .timeout(Duration::from_secs(60*3));

let endpoint = path!(@get /)
    .and(backend)
    .and_then(|session: Session<RedisSession>| {
        session.with(|_session| {
            // ...
        })
    });

Re-exports§

pub use self::redis::Client;

Structs§

RedisBackend
The instance of SessionBackend which uses Redis.
RedisSession