Search in sources :

Example 1 with RedisService

use of org.iplass.mtp.impl.redis.RedisService in project iPLAss by ISID.

the class RedisCacheStoreFactory method inited.

@Override
public void inited(CacheService service, Config config) {
    RedisService rs = config.getDependentService(RedisService.class);
    server = rs.getRedisServer(serverName);
    if (server == null) {
        throw new MtpException("Unknown redis server name: " + serverName);
    }
    ClientResources resouces = DefaultClientResources.builder().build();
    RedisURI.Builder uriBuilder = RedisURI.builder().withHost(server.getHost()).withPort(server.getPort());
    if (server.getTimeout() > 0) {
        uriBuilder.withTimeout(Duration.ofSeconds(server.getTimeout()));
    }
    client = RedisClient.create(resouces, uriBuilder.build());
}
Also used : MtpException(org.iplass.mtp.MtpException) ClientResources(io.lettuce.core.resource.ClientResources) DefaultClientResources(io.lettuce.core.resource.DefaultClientResources) RedisURI(io.lettuce.core.RedisURI) RedisService(org.iplass.mtp.impl.redis.RedisService)

Aggregations

RedisURI (io.lettuce.core.RedisURI)1 ClientResources (io.lettuce.core.resource.ClientResources)1 DefaultClientResources (io.lettuce.core.resource.DefaultClientResources)1 MtpException (org.iplass.mtp.MtpException)1 RedisService (org.iplass.mtp.impl.redis.RedisService)1