Feature - RedisNode.size() method added

pull/5300/head
Nikita Koksharov 1 year ago
parent 02e2bd8857
commit dedc33448a

@ -131,4 +131,11 @@ public interface RedisNode {
*/
void bgRewriteAOF();
/**
* Returns keys amount stored in this Redis node.
*
* @return keys amount
*/
long size();
}

@ -123,4 +123,11 @@ public interface RedisNodeAsync {
*/
RFuture<Void> bgRewriteAOFAsync();
/**
* Returns keys amount stored in this Redis node.
*
* @return keys amount
*/
RFuture<Long> sizeAsync();
}

@ -389,4 +389,15 @@ public class RedisNode implements RedisClusterMaster, RedisClusterSlave, RedisMa
public RFuture<Void> bgRewriteAOFAsync() {
return commandExecutor.writeAsync(client, StringCodec.INSTANCE, RedisCommands.BGREWRITEAOF);
}
@Override
public long size() {
return commandExecutor.get(sizeAsync());
}
@Override
public RFuture<Long> sizeAsync() {
return commandExecutor.writeAsync(client, StringCodec.INSTANCE, RedisCommands.DBSIZE);
}
}

@ -320,4 +320,15 @@ public class SentinelRedisNode implements RedisSentinel, RedisSentinelAsync {
public RFuture<Void> bgRewriteAOFAsync() {
return executeAsync(null, StringCodec.INSTANCE, -1, RedisCommands.BGREWRITEAOF);
}
@Override
public long size() {
return commandAsyncService.get(sizeAsync());
}
@Override
public RFuture<Long> sizeAsync() {
return executeAsync(null, StringCodec.INSTANCE, -1, RedisCommands.DBSIZE);
}
}

Loading…
Cancel
Save