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());
}
Aggregations