Search in sources :

Example 1 with RedisIdExpirationCache

use of uk.gov.ida.hub.samlengine.security.RedisIdExpirationCache in project verify-hub by alphagov.

the class SamlEngineModule method getIdExpirationCache.

private <T> IdExpirationCache<T> getIdExpirationCache(RedisConfiguration config, RedisCodec<T, DateTime> codec, int dbIndex) {
    RedisClient redisClient = RedisClient.create();
    redisClient.setDefaultTimeout(config.getTimeout());
    RedisURI uri = config.getUri();
    uri.setDatabase(dbIndex);
    StatefulRedisMasterSlaveConnection<T, DateTime> redisConnection = MasterSlave.connect(redisClient, codec, singletonList(uri));
    RedisCommands<T, DateTime> redisCommands = redisConnection.sync();
    return new RedisIdExpirationCache<>(redisCommands, config.getRecordTTL());
}
Also used : RedisClient(io.lettuce.core.RedisClient) RedisURI(io.lettuce.core.RedisURI) RedisIdExpirationCache(uk.gov.ida.hub.samlengine.security.RedisIdExpirationCache) DateTime(org.joda.time.DateTime)

Aggregations

RedisClient (io.lettuce.core.RedisClient)1 RedisURI (io.lettuce.core.RedisURI)1 DateTime (org.joda.time.DateTime)1 RedisIdExpirationCache (uk.gov.ida.hub.samlengine.security.RedisIdExpirationCache)1