use of uk.gov.ida.hub.policy.redis.SessionStoreRedisCodec in project verify-hub by alphagov.
the class PolicyAppExtension method getSessionState.
public static <T extends State> T getSessionState(SessionId sessionId, Class<T> stateClazz) {
StatefulRedisConnection<SessionId, State> redisConnection = RedisClient.create().connect(new SessionStoreRedisCodec(PolicyModule.getRedisObjectMapper()), new RedisURI("localhost", REDIS_PORT, Duration.ofSeconds(2)));
RedisSessionStore redisSessionStore = new RedisSessionStore(redisConnection.sync(), 3600L);
return stateClazz.cast(redisSessionStore.get(sessionId));
}
use of uk.gov.ida.hub.policy.redis.SessionStoreRedisCodec in project verify-hub by alphagov.
the class PolicyModule method getRedisSessionStore.
private RedisSessionStore getRedisSessionStore(RedisConfiguration config) {
RedisClient redisClient = RedisClient.create();
redisClient.setDefaultTimeout(config.getTimeout());
StatefulRedisMasterSlaveConnection<SessionId, State> redisConnection = MasterSlave.connect(redisClient, new SessionStoreRedisCodec(getRedisObjectMapper()), singletonList(config.getUri()));
RedisCommands<SessionId, State> redisCommands = redisConnection.sync();
return new RedisSessionStore(redisCommands, config.getRecordTTL());
}
Aggregations