lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

select db problem

Open blacksunset opened this issue 11 years ago • 1 comments

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"); }

blacksunset avatar May 30 '13 05:05 blacksunset

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.

wg avatar May 30 '13 05:05 wg