lettuce
lettuce copied to clipboard
select db problem
This is my code, output "use 70 ms", when i remove "redisConnection.select(8);" output "use 35 ms". so is there any way to execute method select once? and excute method select when it reconnects automatically
@Override public void reportCount(int value) { long start = System.currentTimeMillis(); redisConnection.select(8); redisConnection.incrby("count", value); long time = System.currentTimeMillis() - start; System.out.println("use "+time+"ms"); }
Hello @blacksunset, when a lettuce connection reconnects it will issue an automatic SELECT if necessary. See https://github.com/wg/lettuce/blob/master/src/main/java/com/lambdaworks/redis/RedisAsyncConnection.java#L1001 for details.