ProxySystem/src/main/java/net/krakatoa/proxy/redis/RedisManager.java

31 lines
1.0 KiB
Java

package net.krakatoa.proxy.redis;
import io.lettuce.core.RedisClient;
import io.lettuce.core.dynamic.RedisCommandFactory;
import lombok.Data;
@Data
public class RedisManager {
private final String connectionUri;
private RedisClient client;
//private StatefulRedisConnection<String, String> connection;
//private RedisStringCommands<String, String> commands;
//private RedisKeyReactiveCommands<String, String> keyReactiveCommands;
private RedisKeyCommands redisKeyCommands;
private RedisHashCommands redisHashCommands;
public void connect() {
this.client = RedisClient.create(this.getConnectionUri());
RedisCommandFactory factory = new RedisCommandFactory(client.connect());
factory.setVerifyCommandMethods(false);
this.redisKeyCommands = factory.getCommands(RedisKeyCommands.class);
this.redisHashCommands = factory.getCommands(RedisHashCommands.class);
//this.connection = client.connect();
//this.commands = connection.sync();
//this.keyReactiveCommands = this.connection.reactive();
}
}
// RedisKeyReactiveCommands