ZSetOps#removeRange* return the # of elements removed

DATAREDIS-86
This commit is contained in:
Costin Leau
2012-05-23 20:37:43 +03:00
parent 8684be99fb
commit fa44da26fa
2 changed files with 10 additions and 12 deletions

View File

@@ -232,25 +232,23 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
}
public void removeRange(K key, final long start, final long end) {
public Long removeRange(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zRemRange(rawKey, start, end);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zRemRange(rawKey, start, end);
}
}, true);
}
public void removeRangeByScore(K key, final double min, final double max) {
public Long removeRangeByScore(K key, final double min, final double max) {
final byte[] rawKey = rawKey(key);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zRemRangeByScore(rawKey, min, max);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zRemRangeByScore(rawKey, min, max);
}
}, true);
}

View File

@@ -71,9 +71,9 @@ public interface ZSetOperations<K, V> {
Boolean remove(K key, Object o);
void removeRange(K key, long start, long end);
Long removeRange(K key, long start, long end);
void removeRangeByScore(K key, double min, double max);
Long removeRangeByScore(K key, double min, double max);
Long count(K key, double min, double max);