All Downloads are FREE. Search and download functionalities are using the official Maven repository.

apoc.redis.RedisConnection Maven / Gradle / Ivy

package apoc.redis;

import io.lettuce.core.ClientOptions;
import io.lettuce.core.RedisClient;

abstract class RedisConnection implements IRedisConnection {
    protected final RedisClient client;
    protected final RedisConfig conf;
    
    public RedisConnection(String uri, RedisConfig config) {
        this.conf = config;
        this.client = RedisClient.create(uri);
        this.client.setDefaultTimeout(conf.getTimeout());
        this.client.setOptions(ClientOptions.builder()
                .scriptCharset(conf.getScriptCharset())
                .autoReconnect(conf.isAutoReconnect())
                .build());
    }

    @Override
    public void close() {
        this.client.shutdown();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy