Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
README.md
pom.xml

README.md

Pippo Session Jedis

Jedis Session Manager integration for Pippo

Sample code

First we must add in src/main/resources/conf/application.properties:

# Host of the form "redis://[:password@]host[:port][/db-number][?option=value]"
redis.host = redis://localhost:6379
# Optional
# redis.minIdle = 0
# redis.maxIdle = 8
# redis.maxTotal = 8

Add the following code sniped in your application:

public class MyApplication extends Application {

    private JedisPool client;

    @Override
    protected void onInit() {
        this.client = JedisFactory.create(getPippoSettings());
        // add routes here
    }

    @Override
    protected RequestResponseFactory createRequestResponseFactory() {
        SessionDataStorage sessionDataStorage = new JedisSessionDataStorage(this.client);
        SessionManager sessionManager = new SessionManager(sessionDataStorage);

        return new SessionRequestResponseFactory(this, sessionManager);
    }

    @Override
    protected void onDestroy() {
        this.client.destroy();
    }
}