Adding keySize functionality for MultiMaps - Improvements

pull/528/head
dheeraj 9 years ago
parent 17b724cbb7
commit 15a69f0fc4

@ -66,18 +66,7 @@ public class RedissonListMultimap<K, V> extends RedissonMultimap<K, V> implement
Arrays.<Object>asList(getName()));
}
public Future<Integer> keySizeAsync() {
return commandExecutor.evalReadAsync(getName(), codec, RedisCommands.EVAL_INTEGER,
"local keys = redis.call('hgetall', KEYS[1]); " +
"local size = 0; " +
"for i, v in ipairs(keys) do " +
"if i % 2 == 0 then " +
"size = size + 1; " +
"end;" +
"end; " +
"return size; ",
Arrays.<Object>asList(getName()));
}
public Future<Boolean> containsKeyAsync(Object key) {
try {

@ -255,8 +255,12 @@ public abstract class RedissonMultimap<K, V> extends RedissonExpirable implement
"return redis.call('persist', KEYS[1]); ",
Arrays.<Object>asList(getName()));
}
public Future<Integer> keySizeAsync() {
return commandExecutor.readAsync(getName(), LongCodec.INSTANCE, RedisCommands.HLEN, getName());
}
MapScanResult<ScanObjectEntry, ScanObjectEntry> scanIterator(InetSocketAddress client, long startPos) {
Future<MapScanResult<ScanObjectEntry, ScanObjectEntry>> f = commandExecutor.readAsync(client, getName(), new ScanCodec(codec, StringCodec.INSTANCE), RedisCommands.HSCAN, getName(), startPos);
return get(f);

@ -69,18 +69,7 @@ public class RedissonSetMultimap<K, V> extends RedissonMultimap<K, V> implements
Arrays.<Object>asList(getName()));
}
public Future<Integer> keySizeAsync() {
return commandExecutor.evalReadAsync(getName(), codec, RedisCommands.EVAL_INTEGER,
"local keys = redis.call('hgetall', KEYS[1]); " +
"local size = 0; " +
"for i, v in ipairs(keys) do " +
"if i % 2 == 0 then " +
"size = size + 1; " +
"end;" +
"end; " +
"return size; ",
Arrays.<Object>asList(getName()));
}
public Future<Boolean> containsKeyAsync(Object key) {
try {

Loading…
Cancel
Save