incr/decr operate on 64-bit numbers. Switching from Integer to Long

This commit is contained in:
Neil Gentleman
2010-11-23 16:52:18 -08:00
committed by Jonathan Leibiusky
parent a1815f3881
commit d18cc4bd13
20 changed files with 397 additions and 379 deletions

View File

@@ -93,7 +93,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param key * @param key
* @return Integer reply, "0" if the key exists, otherwise "1" * @return Integer reply, "0" if the key exists, otherwise "1"
*/ */
public Integer exists(final byte[] key) { public Long exists(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.exists(key); client.exists(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -109,7 +109,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: an integer greater than 0 if one or * @return Integer reply, specifically: an integer greater than 0 if one or
* more keys were removed 0 if none of the specified key existed * more keys were removed 0 if none of the specified key existed
*/ */
public Integer del(final byte[]... keys) { public Long del(final byte[]... keys) {
checkIsInMulti(); checkIsInMulti();
client.del(keys); client.del(keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -228,7 +228,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the key was renamed 0 if the * @return Integer reply, specifically: 1 if the key was renamed 0 if the
* target key already exist * target key already exist
*/ */
public Integer renamenx(final byte[] oldkey, final byte[] newkey) { public Long renamenx(final byte[] oldkey, final byte[] newkey) {
checkIsInMulti(); checkIsInMulti();
client.renamenx(oldkey, newkey); client.renamenx(oldkey, newkey);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -239,7 +239,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* *
* @return Integer reply * @return Integer reply
*/ */
public Integer dbSize() { public Long dbSize() {
checkIsInMulti(); checkIsInMulti();
client.dbSize(); client.dbSize();
return client.getIntegerReply(); return client.getIntegerReply();
@@ -273,7 +273,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* 2.1.3 will happily update the timeout), or the key does not * 2.1.3 will happily update the timeout), or the key does not
* exist. * exist.
*/ */
public Integer expire(final byte[] key, final int seconds) { public Long expire(final byte[] key, final int seconds) {
checkIsInMulti(); checkIsInMulti();
client.expire(key, seconds); client.expire(key, seconds);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -309,7 +309,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* 2.1.3 will happily update the timeout), or the key does not * 2.1.3 will happily update the timeout), or the key does not
* exist. * exist.
*/ */
public Integer expireAt(final byte[] key, final long unixTime) { public Long expireAt(final byte[] key, final long unixTime) {
checkIsInMulti(); checkIsInMulti();
client.expireAt(key, unixTime); client.expireAt(key, unixTime);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -326,7 +326,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* key that has an EXPIRE. If the Key does not exists or does not * key that has an EXPIRE. If the Key does not exists or does not
* have an associated expire, -1 is returned. * have an associated expire, -1 is returned.
*/ */
public Integer ttl(final byte[] key) { public Long ttl(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.ttl(key); client.ttl(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -358,7 +358,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* was not moved because already present on the target DB or was not * was not moved because already present on the target DB or was not
* found in the current DB. * found in the current DB.
*/ */
public Integer move(final byte[] key, final int dbIndex) { public Long move(final byte[] key, final int dbIndex) {
checkIsInMulti(); checkIsInMulti();
client.move(key, dbIndex); client.move(key, dbIndex);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -421,7 +421,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the key was set 0 if the key * @return Integer reply, specifically: 1 if the key was set 0 if the key
* was not set * was not set
*/ */
public Integer setnx(final byte[] key, final byte[] value) { public Long setnx(final byte[] key, final byte[] value) {
checkIsInMulti(); checkIsInMulti();
client.setnx(key, value); client.setnx(key, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -492,7 +492,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the all the keys were set 0 if * @return Integer reply, specifically: 1 if the all the keys were set 0 if
* no key was set (at least one key already existed) * no key was set (at least one key already existed)
*/ */
public Integer msetnx(final byte[]... keysvalues) { public Long msetnx(final byte[]... keysvalues) {
checkIsInMulti(); checkIsInMulti();
client.msetnx(keysvalues); client.msetnx(keysvalues);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -520,7 +520,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer decrBy(final byte[] key, final int integer) { public Long decrBy(final byte[] key, final int integer) {
checkIsInMulti(); checkIsInMulti();
client.decrBy(key, integer); client.decrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -548,7 +548,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer decr(final byte[] key) { public Long decr(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.decr(key); client.decr(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -576,7 +576,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer incrBy(final byte[] key, final int integer) { public Long incrBy(final byte[] key, final int integer) {
checkIsInMulti(); checkIsInMulti();
client.incrBy(key, integer); client.incrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -604,7 +604,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer incr(final byte[] key) { public Long incr(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.incr(key); client.incr(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -626,7 +626,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically the total length of the string after * @return Integer reply, specifically the total length of the string after
* the append operation. * the append operation.
*/ */
public Integer append(final byte[] key, final byte[] value) { public Long append(final byte[] key, final byte[] value) {
checkIsInMulti(); checkIsInMulti();
client.append(key, value); client.append(key, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -671,7 +671,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* of the value, 0 is returned, otherwise if a new field is created * of the value, 0 is returned, otherwise if a new field is created
* 1 is returned. * 1 is returned.
*/ */
public Integer hset(final byte[] key, final byte[] field, final byte[] value) { public Long hset(final byte[] key, final byte[] field, final byte[] value) {
checkIsInMulti(); checkIsInMulti();
client.hset(key, field, value); client.hset(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -707,7 +707,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return If the field already exists, 0 is returned, otherwise if a new * @return If the field already exists, 0 is returned, otherwise if a new
* field is created 1 is returned. * field is created 1 is returned.
*/ */
public Integer hsetnx(final byte[] key, final byte[] field, public Long hsetnx(final byte[] key, final byte[] field,
final byte[] value) { final byte[] value) {
checkIsInMulti(); checkIsInMulti();
client.hsetnx(key, field, value); client.hsetnx(key, field, value);
@@ -769,7 +769,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply The new value at field after the increment * @return Integer reply The new value at field after the increment
* operation. * operation.
*/ */
public Integer hincrBy(final byte[] key, final byte[] field, final int value) { public Long hincrBy(final byte[] key, final byte[] field, final int value) {
checkIsInMulti(); checkIsInMulti();
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -785,7 +785,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Return 1 if the hash stored at key contains the specified field. * @return Return 1 if the hash stored at key contains the specified field.
* Return 0 if the key is not found or the field is not present. * Return 0 if the key is not found or the field is not present.
*/ */
public Integer hexists(final byte[] key, final byte[] field) { public Long hexists(final byte[] key, final byte[] field) {
checkIsInMulti(); checkIsInMulti();
client.hexists(key, field); client.hexists(key, field);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -801,7 +801,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return If the field was present in the hash it is deleted and 1 is * @return If the field was present in the hash it is deleted and 1 is
* returned, otherwise 0 is returned and no operation is performed. * returned, otherwise 0 is returned and no operation is performed.
*/ */
public Integer hdel(final byte[] key, final byte[] field) { public Long hdel(final byte[] key, final byte[] field) {
checkIsInMulti(); checkIsInMulti();
client.hdel(key, field); client.hdel(key, field);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -817,7 +817,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* key. If the specified key does not exist, 0 is returned assuming * key. If the specified key does not exist, 0 is returned assuming
* an empty hash. * an empty hash.
*/ */
public Integer hlen(final byte[] key) { public Long hlen(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.hlen(key); client.hlen(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -889,7 +889,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically, the number of elements inside the * @return Integer reply, specifically, the number of elements inside the
* list after the push operation. * list after the push operation.
*/ */
public Integer rpush(final byte[] key, final byte[] string) { public Long rpush(final byte[] key, final byte[] string) {
checkIsInMulti(); checkIsInMulti();
client.rpush(key, string); client.rpush(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -910,7 +910,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically, the number of elements inside the * @return Integer reply, specifically, the number of elements inside the
* list after the push operation. * list after the push operation.
*/ */
public Integer lpush(final byte[] key, final byte[] string) { public Long lpush(final byte[] key, final byte[] string) {
checkIsInMulti(); checkIsInMulti();
client.lpush(key, string); client.lpush(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -926,7 +926,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param key * @param key
* @return The length of the list. * @return The length of the list.
*/ */
public Integer llen(final byte[] key) { public Long llen(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.llen(key); client.llen(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1086,7 +1086,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer Reply, specifically: The number of removed elements if * @return Integer Reply, specifically: The number of removed elements if
* the operation succeeded * the operation succeeded
*/ */
public Integer lrem(final byte[] key, final int count, final byte[] value) { public Long lrem(final byte[] key, final int count, final byte[] value) {
checkIsInMulti(); checkIsInMulti();
client.lrem(key, count, value); client.lrem(key, count, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1167,7 +1167,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the new element was added 0 if * @return Integer reply, specifically: 1 if the new element was added 0 if
* the element was already a member of the set * the element was already a member of the set
*/ */
public Integer sadd(final byte[] key, final byte[] member) { public Long sadd(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.sadd(key, member); client.sadd(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1201,7 +1201,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the new element was removed 0 * @return Integer reply, specifically: 1 if the new element was removed 0
* if the new element was not a member of the set * if the new element was not a member of the set
*/ */
public Integer srem(final byte[] key, final byte[] member) { public Long srem(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.srem(key, member); client.srem(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1248,7 +1248,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* element was not found on the first set and no operation was * element was not found on the first set and no operation was
* performed * performed
*/ */
public Integer smove(final byte[] srckey, final byte[] dstkey, public Long smove(final byte[] srckey, final byte[] dstkey,
final byte[] member) { final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.smove(srckey, dstkey, member); client.smove(srckey, dstkey, member);
@@ -1263,7 +1263,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: the cardinality (number of elements) * @return Integer reply, specifically: the cardinality (number of elements)
* of the set as an integer. * of the set as an integer.
*/ */
public Integer scard(final byte[] key) { public Long scard(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.scard(key); client.scard(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1281,7 +1281,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* set 0 if the element is not a member of the set OR if the key * set 0 if the element is not a member of the set OR if the key
* does not exist * does not exist
*/ */
public Integer sismember(final byte[] key, final byte[] member) { public Long sismember(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.sismember(key, member); client.sismember(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1324,7 +1324,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sinterstore(final byte[] dstkey, final byte[]... keys) { public Long sinterstore(final byte[] dstkey, final byte[]... keys) {
checkIsInMulti(); checkIsInMulti();
client.sinterstore(dstkey, keys); client.sinterstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1365,7 +1365,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sunionstore(final byte[] dstkey, final byte[]... keys) { public Long sunionstore(final byte[] dstkey, final byte[]... keys) {
checkIsInMulti(); checkIsInMulti();
client.sunionstore(dstkey, keys); client.sunionstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1409,7 +1409,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sdiffstore(final byte[] dstkey, final byte[]... keys) { public Long sdiffstore(final byte[] dstkey, final byte[]... keys) {
checkIsInMulti(); checkIsInMulti();
client.sdiffstore(dstkey, keys); client.sdiffstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1454,7 +1454,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* the element was already a member of the sorted set and the score * the element was already a member of the sorted set and the score
* was updated * was updated
*/ */
public Integer zadd(final byte[] key, final double score, public Long zadd(final byte[] key, final double score,
final byte[] member) { final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.zadd(key, score, member); client.zadd(key, score, member);
@@ -1483,7 +1483,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1 if the new element was removed 0 * @return Integer reply, specifically: 1 if the new element was removed 0
* if the new element was not a member of the set * if the new element was not a member of the set
*/ */
public Integer zrem(final byte[] key, final byte[] member) { public Long zrem(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.zrem(key, member); client.zrem(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1541,7 +1541,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* element as an integer reply if the element exists. A nil bulk * element as an integer reply if the element exists. A nil bulk
* reply if there is no such element. * reply if there is no such element.
*/ */
public Integer zrank(final byte[] key, final byte[] member) { public Long zrank(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.zrank(key, member); client.zrank(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1567,7 +1567,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* element as an integer reply if the element exists. A nil bulk * element as an integer reply if the element exists. A nil bulk
* reply if there is no such element. * reply if there is no such element.
*/ */
public Integer zrevrank(final byte[] key, final byte[] member) { public Long zrevrank(final byte[] key, final byte[] member) {
checkIsInMulti(); checkIsInMulti();
client.zrevrank(key, member); client.zrevrank(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1606,7 +1606,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param key * @param key
* @return the cardinality (number of elements) of the set as an integer. * @return the cardinality (number of elements) of the set as an integer.
*/ */
public Integer zcard(final byte[] key) { public Long zcard(final byte[] key) {
checkIsInMulti(); checkIsInMulti();
client.zcard(key); client.zcard(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1880,7 +1880,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param dstkey * @param dstkey
* @return The number of elements of the list at dstkey. * @return The number of elements of the list at dstkey.
*/ */
public Integer sort(final byte[] key, public Long sort(final byte[] key,
final SortingParams sortingParameters, final byte[] dstkey) { final SortingParams sortingParameters, final byte[] dstkey) {
checkIsInMulti(); checkIsInMulti();
client.sort(key, sortingParameters, dstkey); client.sort(key, sortingParameters, dstkey);
@@ -1903,7 +1903,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param dstkey * @param dstkey
* @return The number of elements of the list at dstkey. * @return The number of elements of the list at dstkey.
*/ */
public Integer sort(final byte[] key, final byte[] dstkey) { public Long sort(final byte[] key, final byte[] dstkey) {
checkIsInMulti(); checkIsInMulti();
client.sort(key, dstkey); client.sort(key, dstkey);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2031,7 +2031,7 @@ public class BinaryJedis implements BinaryJedisCommands {
client.rollbackTimeout(); client.rollbackTimeout();
} }
public Integer publish(final String channel, final String message) { public Long publish(final String channel, final String message) {
client.publish(channel, message); client.publish(channel, message);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2043,7 +2043,7 @@ public class BinaryJedis implements BinaryJedisCommands {
client.rollbackTimeout(); client.rollbackTimeout();
} }
public Integer zcount(final byte[] key, final double min, final double max) { public Long zcount(final byte[] key, final double min, final double max) {
checkIsInMulti(); checkIsInMulti();
client.zcount(key, min, max); client.zcount(key, min, max);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2337,7 +2337,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* operation * operation
* *
*/ */
public Integer zremrangeByRank(final byte[] key, final int start, public Long zremrangeByRank(final byte[] key, final int start,
final int end) { final int end) {
checkIsInMulti(); checkIsInMulti();
client.zremrangeByRank(key, start, end); client.zremrangeByRank(key, start, end);
@@ -2358,7 +2358,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @param end * @param end
* @return Integer reply, specifically the number of elements removed. * @return Integer reply, specifically the number of elements removed.
*/ */
public Integer zremrangeByScore(final byte[] key, final double start, public Long zremrangeByScore(final byte[] key, final double start,
final double end) { final double end) {
checkIsInMulti(); checkIsInMulti();
client.zremrangeByScore(key, start, end); client.zremrangeByScore(key, start, end);
@@ -2403,7 +2403,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zunionstore(final byte[] dstkey, final byte[]... sets) { public Long zunionstore(final byte[] dstkey, final byte[]... sets) {
checkIsInMulti(); checkIsInMulti();
client.zunionstore(dstkey, sets); client.zunionstore(dstkey, sets);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2448,7 +2448,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zunionstore(final byte[] dstkey, final ZParams params, public Long zunionstore(final byte[] dstkey, final ZParams params,
final byte[]... sets) { final byte[]... sets) {
checkIsInMulti(); checkIsInMulti();
client.zunionstore(dstkey, params, sets); client.zunionstore(dstkey, params, sets);
@@ -2493,7 +2493,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zinterstore(final byte[] dstkey, final byte[]... sets) { public Long zinterstore(final byte[] dstkey, final byte[]... sets) {
checkIsInMulti(); checkIsInMulti();
client.zinterstore(dstkey, sets); client.zinterstore(dstkey, sets);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2538,7 +2538,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zinterstore(final byte[] dstkey, final ZParams params, public Long zinterstore(final byte[] dstkey, final ZParams params,
final byte[]... sets) { final byte[]... sets) {
checkIsInMulti(); checkIsInMulti();
client.zinterstore(dstkey, params, sets); client.zinterstore(dstkey, params, sets);
@@ -2615,7 +2615,7 @@ public class BinaryJedis implements BinaryJedisCommands {
* *
* @return Integer reply, specifically an UNIX time stamp. * @return Integer reply, specifically an UNIX time stamp.
*/ */
public Integer lastsave() { public Long lastsave() {
client.lastsave(); client.lastsave();
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2822,7 +2822,7 @@ public class BinaryJedis implements BinaryJedisCommands {
return client.isConnected(); return client.isConnected();
} }
public Integer strlen(final byte[] key) { public Long strlen(final byte[] key) {
client.strlen(key); client.strlen(key);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2831,7 +2831,7 @@ public class BinaryJedis implements BinaryJedisCommands {
client.sync(); client.sync();
} }
public Integer lpushx(final byte[] key, final byte[] string) { public Long lpushx(final byte[] key, final byte[] string) {
client.lpushx(key, string); client.lpushx(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2846,12 +2846,12 @@ public class BinaryJedis implements BinaryJedisCommands {
* @return Integer reply, specifically: 1: the key is now persist. 0: the * @return Integer reply, specifically: 1: the key is now persist. 0: the
* key is not persist (only happens when key not set). * key is not persist (only happens when key not set).
*/ */
public Integer persist(final byte[] key) { public Long persist(final byte[] key) {
client.persist(key); client.persist(key);
return client.getIntegerReply(); return client.getIntegerReply();
} }
public Integer rpushx(final byte[] key, final byte[] string) { public Long rpushx(final byte[] key, final byte[] string) {
client.rpushx(key, string); client.rpushx(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2861,7 +2861,7 @@ public class BinaryJedis implements BinaryJedisCommands {
return client.getBinaryBulkReply(); return client.getBinaryBulkReply();
} }
public Integer linsert(final byte[] key, final LIST_POSITION where, public Long linsert(final byte[] key, final LIST_POSITION where,
final byte[] pivot, final byte[] value) { final byte[] pivot, final byte[] value) {
client.linsert(key, where, pivot, value); client.linsert(key, where, pivot, value);
return client.getIntegerReply(); return client.getIntegerReply();

View File

@@ -15,51 +15,51 @@ public interface BinaryJedisCommands {
byte[] get(byte[] key); byte[] get(byte[] key);
Integer exists(byte[] key); Long exists(byte[] key);
String type(byte[] key); String type(byte[] key);
Integer expire(byte[] key, int seconds); Long expire(byte[] key, int seconds);
Integer expireAt(byte[] key, long unixTime); Long expireAt(byte[] key, long unixTime);
Integer ttl(byte[] key); Long ttl(byte[] key);
byte[] getSet(byte[] key, byte[] value); byte[] getSet(byte[] key, byte[] value);
Integer setnx(byte[] key, byte[] value); Long setnx(byte[] key, byte[] value);
String setex(byte[] key, int seconds, byte[] value); String setex(byte[] key, int seconds, byte[] value);
Integer decrBy(byte[] key, int integer); Long decrBy(byte[] key, int integer);
Integer decr(byte[] key); Long decr(byte[] key);
Integer incrBy(byte[] key, int integer); Long incrBy(byte[] key, int integer);
Integer incr(byte[] key); Long incr(byte[] key);
Integer append(byte[] key, byte[] value); Long append(byte[] key, byte[] value);
byte[] substr(byte[] key, int start, int end); byte[] substr(byte[] key, int start, int end);
Integer hset(byte[] key, byte[] field, byte[] value); Long hset(byte[] key, byte[] field, byte[] value);
byte[] hget(byte[] key, byte[] field); byte[] hget(byte[] key, byte[] field);
Integer hsetnx(byte[] key, byte[] field, byte[] value); Long hsetnx(byte[] key, byte[] field, byte[] value);
String hmset(byte[] key, Map<byte[], byte[]> hash); String hmset(byte[] key, Map<byte[], byte[]> hash);
List<byte[]> hmget(byte[] key, byte[]... fields); List<byte[]> hmget(byte[] key, byte[]... fields);
Integer hincrBy(byte[] key, byte[] field, int value); Long hincrBy(byte[] key, byte[] field, int value);
Integer hexists(byte[] key, byte[] field); Long hexists(byte[] key, byte[] field);
Integer hdel(byte[] key, byte[] field); Long hdel(byte[] key, byte[] field);
Integer hlen(byte[] key); Long hlen(byte[] key);
Set<byte[]> hkeys(byte[] key); Set<byte[]> hkeys(byte[] key);
@@ -67,11 +67,11 @@ public interface BinaryJedisCommands {
Map<byte[], byte[]> hgetAll(byte[] key); Map<byte[], byte[]> hgetAll(byte[] key);
Integer rpush(byte[] key, byte[] string); Long rpush(byte[] key, byte[] string);
Integer lpush(byte[] key, byte[] string); Long lpush(byte[] key, byte[] string);
Integer llen(byte[] key); Long llen(byte[] key);
List<byte[]> lrange(byte[] key, int start, int end); List<byte[]> lrange(byte[] key, int start, int end);
@@ -81,37 +81,37 @@ public interface BinaryJedisCommands {
String lset(byte[] key, int index, byte[] value); String lset(byte[] key, int index, byte[] value);
Integer lrem(byte[] key, int count, byte[] value); Long lrem(byte[] key, int count, byte[] value);
byte[] lpop(byte[] key); byte[] lpop(byte[] key);
byte[] rpop(byte[] key); byte[] rpop(byte[] key);
Integer sadd(byte[] key, byte[] member); Long sadd(byte[] key, byte[] member);
Set<byte[]> smembers(byte[] key); Set<byte[]> smembers(byte[] key);
Integer srem(byte[] key, byte[] member); Long srem(byte[] key, byte[] member);
byte[] spop(byte[] key); byte[] spop(byte[] key);
Integer scard(byte[] key); Long scard(byte[] key);
Integer sismember(byte[] key, byte[] member); Long sismember(byte[] key, byte[] member);
byte[] srandmember(byte[] key); byte[] srandmember(byte[] key);
Integer zadd(byte[] key, double score, byte[] member); Long zadd(byte[] key, double score, byte[] member);
Set<byte[]> zrange(byte[] key, int start, int end); Set<byte[]> zrange(byte[] key, int start, int end);
Integer zrem(byte[] key, byte[] member); Long zrem(byte[] key, byte[] member);
Double zincrby(byte[] key, double score, byte[] member); Double zincrby(byte[] key, double score, byte[] member);
Integer zrank(byte[] key, byte[] member); Long zrank(byte[] key, byte[] member);
Integer zrevrank(byte[] key, byte[] member); Long zrevrank(byte[] key, byte[] member);
Set<byte[]> zrevrange(byte[] key, int start, int end); Set<byte[]> zrevrange(byte[] key, int start, int end);
@@ -119,7 +119,7 @@ public interface BinaryJedisCommands {
Set<Tuple> zrevrangeWithScores(byte[] key, int start, int end); Set<Tuple> zrevrangeWithScores(byte[] key, int start, int end);
Integer zcard(byte[] key); Long zcard(byte[] key);
Double zscore(byte[] key, byte[] member); Double zscore(byte[] key, byte[] member);
@@ -127,7 +127,7 @@ public interface BinaryJedisCommands {
List<byte[]> sort(byte[] key, SortingParams sortingParameters); List<byte[]> sort(byte[] key, SortingParams sortingParameters);
Integer zcount(byte[] key, double min, double max); Long zcount(byte[] key, double min, double max);
Set<byte[]> zrangeByScore(byte[] key, double min, double max); Set<byte[]> zrangeByScore(byte[] key, double min, double max);
@@ -147,11 +147,11 @@ public interface BinaryJedisCommands {
int offset, int offset,
int count); int count);
Integer zremrangeByRank(byte[] key, int start, int end); Long zremrangeByRank(byte[] key, int start, int end);
Integer zremrangeByScore(byte[] key, double start, double end); Long zremrangeByScore(byte[] key, double start, double end);
Integer linsert( Long linsert(
byte[] key, byte[] key,
LIST_POSITION where, LIST_POSITION where,
byte[] pivot, byte[] pivot,

View File

@@ -50,7 +50,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.get(key); return j.get(key);
} }
public Integer exists(byte[] key) { public Long exists(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.exists(key); return j.exists(key);
} }
@@ -60,17 +60,17 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.type(key); return j.type(key);
} }
public Integer expire(byte[] key, int seconds) { public Long expire(byte[] key, int seconds) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.expire(key, seconds); return j.expire(key, seconds);
} }
public Integer expireAt(byte[] key, long unixTime) { public Long expireAt(byte[] key, long unixTime) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.expireAt(key, unixTime); return j.expireAt(key, unixTime);
} }
public Integer ttl(byte[] key) { public Long ttl(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.ttl(key); return j.ttl(key);
} }
@@ -80,7 +80,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.getSet(key, value); return j.getSet(key, value);
} }
public Integer setnx(byte[] key, byte[] value) { public Long setnx(byte[] key, byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.setnx(key, value); return j.setnx(key, value);
} }
@@ -90,27 +90,27 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.setex(key, seconds, value); return j.setex(key, seconds, value);
} }
public Integer decrBy(byte[] key, int integer) { public Long decrBy(byte[] key, int integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decrBy(key, integer); return j.decrBy(key, integer);
} }
public Integer decr(byte[] key) { public Long decr(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decr(key); return j.decr(key);
} }
public Integer incrBy(byte[] key, int integer) { public Long incrBy(byte[] key, int integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incrBy(key, integer); return j.incrBy(key, integer);
} }
public Integer incr(byte[] key) { public Long incr(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incr(key); return j.incr(key);
} }
public Integer append(byte[] key, byte[] value) { public Long append(byte[] key, byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.append(key, value); return j.append(key, value);
} }
@@ -120,7 +120,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.substr(key, start, end); return j.substr(key, start, end);
} }
public Integer hset(byte[] key, byte[] field, byte[] value) { public Long hset(byte[] key, byte[] field, byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hset(key, field, value); return j.hset(key, field, value);
} }
@@ -130,7 +130,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.hget(key, field); return j.hget(key, field);
} }
public Integer hsetnx(byte[] key, byte[] field, byte[] value) { public Long hsetnx(byte[] key, byte[] field, byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hsetnx(key, field, value); return j.hsetnx(key, field, value);
} }
@@ -145,22 +145,22 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.hmget(key, fields); return j.hmget(key, fields);
} }
public Integer hincrBy(byte[] key, byte[] field, int value) { public Long hincrBy(byte[] key, byte[] field, int value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hincrBy(key, field, value); return j.hincrBy(key, field, value);
} }
public Integer hexists(byte[] key, byte[] field) { public Long hexists(byte[] key, byte[] field) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hexists(key, field); return j.hexists(key, field);
} }
public Integer hdel(byte[] key, byte[] field) { public Long hdel(byte[] key, byte[] field) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hdel(key, field); return j.hdel(key, field);
} }
public Integer hlen(byte[] key) { public Long hlen(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hlen(key); return j.hlen(key);
} }
@@ -180,17 +180,17 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.hgetAll(key); return j.hgetAll(key);
} }
public Integer rpush(byte[] key, byte[] string) { public Long rpush(byte[] key, byte[] string) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.rpush(key, string); return j.rpush(key, string);
} }
public Integer lpush(byte[] key, byte[] string) { public Long lpush(byte[] key, byte[] string) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.lpush(key, string); return j.lpush(key, string);
} }
public Integer llen(byte[] key) { public Long llen(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.llen(key); return j.llen(key);
} }
@@ -215,7 +215,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.lset(key, index, value); return j.lset(key, index, value);
} }
public Integer lrem(byte[] key, int count, byte[] value) { public Long lrem(byte[] key, int count, byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.lrem(key, count, value); return j.lrem(key, count, value);
} }
@@ -230,7 +230,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.rpop(key); return j.rpop(key);
} }
public Integer sadd(byte[] key, byte[] member) { public Long sadd(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.sadd(key, member); return j.sadd(key, member);
} }
@@ -240,7 +240,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.smembers(key); return j.smembers(key);
} }
public Integer srem(byte[] key, byte[] member) { public Long srem(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.srem(key, member); return j.srem(key, member);
} }
@@ -250,12 +250,12 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.spop(key); return j.spop(key);
} }
public Integer scard(byte[] key) { public Long scard(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.scard(key); return j.scard(key);
} }
public Integer sismember(byte[] key, byte[] member) { public Long sismember(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.sismember(key, member); return j.sismember(key, member);
} }
@@ -265,7 +265,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.srandmember(key); return j.srandmember(key);
} }
public Integer zadd(byte[] key, double score, byte[] member) { public Long zadd(byte[] key, double score, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zadd(key, score, member); return j.zadd(key, score, member);
} }
@@ -275,7 +275,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.zrange(key, start, end); return j.zrange(key, start, end);
} }
public Integer zrem(byte[] key, byte[] member) { public Long zrem(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrem(key, member); return j.zrem(key, member);
} }
@@ -285,12 +285,12 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.zincrby(key, score, member); return j.zincrby(key, score, member);
} }
public Integer zrank(byte[] key, byte[] member) { public Long zrank(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrank(key, member); return j.zrank(key, member);
} }
public Integer zrevrank(byte[] key, byte[] member) { public Long zrevrank(byte[] key, byte[] member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrevrank(key, member); return j.zrevrank(key, member);
} }
@@ -310,7 +310,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.zrevrangeWithScores(key, start, end); return j.zrevrangeWithScores(key, start, end);
} }
public Integer zcard(byte[] key) { public Long zcard(byte[] key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zcard(key); return j.zcard(key);
} }
@@ -330,7 +330,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.sort(key, sortingParameters); return j.sort(key, sortingParameters);
} }
public Integer zcount(byte[] key, double min, double max) { public Long zcount(byte[] key, double min, double max) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zcount(key, min, max); return j.zcount(key, min, max);
} }
@@ -357,17 +357,17 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.zrangeByScoreWithScores(key, min, max, offset, count); return j.zrangeByScoreWithScores(key, min, max, offset, count);
} }
public Integer zremrangeByRank(byte[] key, int start, int end) { public Long zremrangeByRank(byte[] key, int start, int end) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zremrangeByRank(key, start, end); return j.zremrangeByRank(key, start, end);
} }
public Integer zremrangeByScore(byte[] key, double start, double end) { public Long zremrangeByScore(byte[] key, double start, double end) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zremrangeByScore(key, start, end); return j.zremrangeByScore(key, start, end);
} }
public Integer linsert(byte[] key, LIST_POSITION where, byte[] pivot, public Long linsert(byte[] key, LIST_POSITION where, byte[] pivot,
byte[] value) { byte[] value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.linsert(key, where, pivot, value); return j.linsert(key, where, pivot, value);

View File

@@ -163,9 +163,9 @@ public class Connection {
return (byte[]) protocol.read(inputStream); return (byte[]) protocol.read(inputStream);
} }
public Integer getIntegerReply() { public Long getIntegerReply() {
pipelinedCommands--; pipelinedCommands--;
return (Integer) protocol.read(inputStream); return (Long) protocol.read(inputStream);
} }
public List<String> getMultiBulkReply() { public List<String> getMultiBulkReply() {

View File

@@ -30,7 +30,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
super(shardInfo); super(shardInfo);
} }
public String ping() { @Override
public String ping() {
runChecks(); runChecks();
client.ping(); client.ping();
return client.getStatusCodeReply(); return client.getStatusCodeReply();
@@ -71,7 +72,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
/** /**
* Ask the server to silently close the connection. * Ask the server to silently close the connection.
*/ */
public void quit() { @Override
public void quit() {
runChecks(); runChecks();
client.quit(); client.quit();
} }
@@ -86,7 +88,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param key * @param key
* @return Integer reply, "0" if the key exists, otherwise "1" * @return Integer reply, "0" if the key exists, otherwise "1"
*/ */
public Integer exists(final String key) { public Long exists(final String key) {
runChecks(); runChecks();
client.exists(key); client.exists(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -102,7 +104,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: an integer greater than 0 if one or * @return Integer reply, specifically: an integer greater than 0 if one or
* more keys were removed 0 if none of the specified key existed * more keys were removed 0 if none of the specified key existed
*/ */
public Integer del(final String... keys) { public Long del(final String... keys) {
runChecks(); runChecks();
client.del(keys); client.del(keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -134,7 +136,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* *
* @return Status code reply * @return Status code reply
*/ */
public String flushDB() { @Override
public String flushDB() {
runChecks(); runChecks();
client.flushDB(); client.flushDB();
return client.getStatusCodeReply(); return client.getStatusCodeReply();
@@ -221,7 +224,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the key was renamed 0 if the * @return Integer reply, specifically: 1 if the key was renamed 0 if the
* target key already exist * target key already exist
*/ */
public Integer renamenx(final String oldkey, final String newkey) { public Long renamenx(final String oldkey, final String newkey) {
runChecks(); runChecks();
client.renamenx(oldkey, newkey); client.renamenx(oldkey, newkey);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -232,7 +235,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* *
* @return Integer reply * @return Integer reply
*/ */
public Integer dbSize() { @Override
public Long dbSize() {
runChecks(); runChecks();
client.dbSize(); client.dbSize();
return client.getIntegerReply(); return client.getIntegerReply();
@@ -266,7 +270,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* 2.1.3 will happily update the timeout), or the key does not * 2.1.3 will happily update the timeout), or the key does not
* exist. * exist.
*/ */
public Integer expire(final String key, final int seconds) { public Long expire(final String key, final int seconds) {
runChecks(); runChecks();
client.expire(key, seconds); client.expire(key, seconds);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -302,7 +306,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* 2.1.3 will happily update the timeout), or the key does not * 2.1.3 will happily update the timeout), or the key does not
* exist. * exist.
*/ */
public Integer expireAt(final String key, final long unixTime) { public Long expireAt(final String key, final long unixTime) {
runChecks(); runChecks();
client.expireAt(key, unixTime); client.expireAt(key, unixTime);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -319,7 +323,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* key that has an EXPIRE. If the Key does not exists or does not * key that has an EXPIRE. If the Key does not exists or does not
* have an associated expire, -1 is returned. * have an associated expire, -1 is returned.
*/ */
public Integer ttl(final String key) { public Long ttl(final String key) {
runChecks(); runChecks();
client.ttl(key); client.ttl(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -332,7 +336,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param index * @param index
* @return Status code reply * @return Status code reply
*/ */
public String select(final int index) { @Override
public String select(final int index) {
runChecks(); runChecks();
client.select(index); client.select(index);
return client.getStatusCodeReply(); return client.getStatusCodeReply();
@@ -351,7 +356,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* was not moved because already present on the target DB or was not * was not moved because already present on the target DB or was not
* found in the current DB. * found in the current DB.
*/ */
public Integer move(final String key, final int dbIndex) { public Long move(final String key, final int dbIndex) {
runChecks(); runChecks();
client.move(key, dbIndex); client.move(key, dbIndex);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -363,7 +368,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* *
* @return Status code reply * @return Status code reply
*/ */
public String flushAll() { @Override
public String flushAll() {
runChecks(); runChecks();
client.flushAll(); client.flushAll();
return client.getStatusCodeReply(); return client.getStatusCodeReply();
@@ -414,7 +420,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the key was set 0 if the key * @return Integer reply, specifically: 1 if the key was set 0 if the key
* was not set * was not set
*/ */
public Integer setnx(final String key, final String value) { public Long setnx(final String key, final String value) {
runChecks(); runChecks();
client.setnx(key, value); client.setnx(key, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -485,7 +491,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the all the keys were set 0 if * @return Integer reply, specifically: 1 if the all the keys were set 0 if
* no key was set (at least one key already existed) * no key was set (at least one key already existed)
*/ */
public Integer msetnx(final String... keysvalues) { public Long msetnx(final String... keysvalues) {
runChecks(); runChecks();
client.msetnx(keysvalues); client.msetnx(keysvalues);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -513,7 +519,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer decrBy(final String key, final int integer) { public Long decrBy(final String key, final int integer) {
runChecks(); runChecks();
client.decrBy(key, integer); client.decrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -541,7 +547,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer decr(final String key) { public Long decr(final String key) {
runChecks(); runChecks();
client.decr(key); client.decr(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -569,7 +575,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer incrBy(final String key, final int integer) { public Long incrBy(final String key, final int integer) {
runChecks(); runChecks();
client.incrBy(key, integer); client.incrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -597,7 +603,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, this commands will reply with the new value of key * @return Integer reply, this commands will reply with the new value of key
* after the increment. * after the increment.
*/ */
public Integer incr(final String key) { public Long incr(final String key) {
runChecks(); runChecks();
client.incr(key); client.incr(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -619,7 +625,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically the total length of the string after * @return Integer reply, specifically the total length of the string after
* the append operation. * the append operation.
*/ */
public Integer append(final String key, final String value) { public Long append(final String key, final String value) {
runChecks(); runChecks();
client.append(key, value); client.append(key, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -664,7 +670,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* of the value, 0 is returned, otherwise if a new field is created * of the value, 0 is returned, otherwise if a new field is created
* 1 is returned. * 1 is returned.
*/ */
public Integer hset(final String key, final String field, final String value) { public Long hset(final String key, final String field, final String value) {
runChecks(); runChecks();
client.hset(key, field, value); client.hset(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -700,7 +706,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return If the field already exists, 0 is returned, otherwise if a new * @return If the field already exists, 0 is returned, otherwise if a new
* field is created 1 is returned. * field is created 1 is returned.
*/ */
public Integer hsetnx(final String key, final String field, public Long hsetnx(final String key, final String field,
final String value) { final String value) {
runChecks(); runChecks();
client.hsetnx(key, field, value); client.hsetnx(key, field, value);
@@ -762,7 +768,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply The new value at field after the increment * @return Integer reply The new value at field after the increment
* operation. * operation.
*/ */
public Integer hincrBy(final String key, final String field, final int value) { public Long hincrBy(final String key, final String field, final int value) {
runChecks(); runChecks();
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -778,7 +784,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Return 1 if the hash stored at key contains the specified field. * @return Return 1 if the hash stored at key contains the specified field.
* Return 0 if the key is not found or the field is not present. * Return 0 if the key is not found or the field is not present.
*/ */
public Integer hexists(final String key, final String field) { public Long hexists(final String key, final String field) {
runChecks(); runChecks();
client.hexists(key, field); client.hexists(key, field);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -794,7 +800,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return If the field was present in the hash it is deleted and 1 is * @return If the field was present in the hash it is deleted and 1 is
* returned, otherwise 0 is returned and no operation is performed. * returned, otherwise 0 is returned and no operation is performed.
*/ */
public Integer hdel(final String key, final String field) { public Long hdel(final String key, final String field) {
runChecks(); runChecks();
client.hdel(key, field); client.hdel(key, field);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -810,7 +816,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* key. If the specified key does not exist, 0 is returned assuming * key. If the specified key does not exist, 0 is returned assuming
* an empty hash. * an empty hash.
*/ */
public Integer hlen(final String key) { public Long hlen(final String key) {
runChecks(); runChecks();
client.hlen(key); client.hlen(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -882,7 +888,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically, the number of elements inside the * @return Integer reply, specifically, the number of elements inside the
* list after the push operation. * list after the push operation.
*/ */
public Integer rpush(final String key, final String string) { public Long rpush(final String key, final String string) {
runChecks(); runChecks();
client.rpush(key, string); client.rpush(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -903,7 +909,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically, the number of elements inside the * @return Integer reply, specifically, the number of elements inside the
* list after the push operation. * list after the push operation.
*/ */
public Integer lpush(final String key, final String string) { public Long lpush(final String key, final String string) {
runChecks(); runChecks();
client.lpush(key, string); client.lpush(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -919,7 +925,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param key * @param key
* @return The length of the list. * @return The length of the list.
*/ */
public Integer llen(final String key) { public Long llen(final String key) {
runChecks(); runChecks();
client.llen(key); client.llen(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1079,7 +1085,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer Reply, specifically: The number of removed elements if * @return Integer Reply, specifically: The number of removed elements if
* the operation succeeded * the operation succeeded
*/ */
public Integer lrem(final String key, final int count, final String value) { public Long lrem(final String key, final int count, final String value) {
runChecks(); runChecks();
client.lrem(key, count, value); client.lrem(key, count, value);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1160,7 +1166,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the new element was added 0 if * @return Integer reply, specifically: 1 if the new element was added 0 if
* the element was already a member of the set * the element was already a member of the set
*/ */
public Integer sadd(final String key, final String member) { public Long sadd(final String key, final String member) {
runChecks(); runChecks();
client.sadd(key, member); client.sadd(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1194,7 +1200,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the new element was removed 0 * @return Integer reply, specifically: 1 if the new element was removed 0
* if the new element was not a member of the set * if the new element was not a member of the set
*/ */
public Integer srem(final String key, final String member) { public Long srem(final String key, final String member) {
runChecks(); runChecks();
client.srem(key, member); client.srem(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1241,7 +1247,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* element was not found on the first set and no operation was * element was not found on the first set and no operation was
* performed * performed
*/ */
public Integer smove(final String srckey, final String dstkey, public Long smove(final String srckey, final String dstkey,
final String member) { final String member) {
runChecks(); runChecks();
client.smove(srckey, dstkey, member); client.smove(srckey, dstkey, member);
@@ -1256,7 +1262,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: the cardinality (number of elements) * @return Integer reply, specifically: the cardinality (number of elements)
* of the set as an integer. * of the set as an integer.
*/ */
public Integer scard(final String key) { public Long scard(final String key) {
runChecks(); runChecks();
client.scard(key); client.scard(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1274,7 +1280,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* set 0 if the element is not a member of the set OR if the key * set 0 if the element is not a member of the set OR if the key
* does not exist * does not exist
*/ */
public Integer sismember(final String key, final String member) { public Long sismember(final String key, final String member) {
runChecks(); runChecks();
client.sismember(key, member); client.sismember(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1317,7 +1323,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sinterstore(final String dstkey, final String... keys) { public Long sinterstore(final String dstkey, final String... keys) {
runChecks(); runChecks();
client.sinterstore(dstkey, keys); client.sinterstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1358,7 +1364,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sunionstore(final String dstkey, final String... keys) { public Long sunionstore(final String dstkey, final String... keys) {
runChecks(); runChecks();
client.sunionstore(dstkey, keys); client.sunionstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1402,7 +1408,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param keys * @param keys
* @return Status code reply * @return Status code reply
*/ */
public Integer sdiffstore(final String dstkey, final String... keys) { public Long sdiffstore(final String dstkey, final String... keys) {
runChecks(); runChecks();
client.sdiffstore(dstkey, keys); client.sdiffstore(dstkey, keys);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1447,7 +1453,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* the element was already a member of the sorted set and the score * the element was already a member of the sorted set and the score
* was updated * was updated
*/ */
public Integer zadd(final String key, final double score, public Long zadd(final String key, final double score,
final String member) { final String member) {
runChecks(); runChecks();
client.zadd(key, score, member); client.zadd(key, score, member);
@@ -1476,7 +1482,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1 if the new element was removed 0 * @return Integer reply, specifically: 1 if the new element was removed 0
* if the new element was not a member of the set * if the new element was not a member of the set
*/ */
public Integer zrem(final String key, final String member) { public Long zrem(final String key, final String member) {
runChecks(); runChecks();
client.zrem(key, member); client.zrem(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1534,7 +1540,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* element as an integer reply if the element exists. A nil bulk * element as an integer reply if the element exists. A nil bulk
* reply if there is no such element. * reply if there is no such element.
*/ */
public Integer zrank(final String key, final String member) { public Long zrank(final String key, final String member) {
runChecks(); runChecks();
client.zrank(key, member); client.zrank(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1560,7 +1566,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* element as an integer reply if the element exists. A nil bulk * element as an integer reply if the element exists. A nil bulk
* reply if there is no such element. * reply if there is no such element.
*/ */
public Integer zrevrank(final String key, final String member) { public Long zrevrank(final String key, final String member) {
runChecks(); runChecks();
client.zrevrank(key, member); client.zrevrank(key, member);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1599,7 +1605,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param key * @param key
* @return the cardinality (number of elements) of the set as an integer. * @return the cardinality (number of elements) of the set as an integer.
*/ */
public Integer zcard(final String key) { public Long zcard(final String key) {
runChecks(); runChecks();
client.zcard(key); client.zcard(key);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -1623,13 +1629,15 @@ public class Jedis extends BinaryJedis implements JedisCommands {
return (score != null ? new Double(score) : null); return (score != null ? new Double(score) : null);
} }
public Transaction multi() { @Override
public Transaction multi() {
client.multi(); client.multi();
client.getStatusCodeReply(); client.getStatusCodeReply();
return new Transaction(client); return new Transaction(client);
} }
public List<Object> multi(TransactionBlock jedisTransaction) { @Override
public List<Object> multi(TransactionBlock jedisTransaction) {
List<Object> results = null; List<Object> results = null;
try { try {
jedisTransaction.setClient(client); jedisTransaction.setClient(client);
@@ -1656,7 +1664,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
} }
} }
public void connect() throws UnknownHostException, IOException { @Override
public void connect() throws UnknownHostException, IOException {
if (!client.isConnected()) { if (!client.isConnected()) {
client.connect(); client.connect();
if (this.password != null) { if (this.password != null) {
@@ -1665,7 +1674,8 @@ public class Jedis extends BinaryJedis implements JedisCommands {
} }
} }
public void disconnect() throws IOException { @Override
public void disconnect() throws IOException {
client.disconnect(); client.disconnect();
} }
@@ -1880,7 +1890,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param dstkey * @param dstkey
* @return The number of elements of the list at dstkey. * @return The number of elements of the list at dstkey.
*/ */
public Integer sort(final String key, public Long sort(final String key,
final SortingParams sortingParameters, final String dstkey) { final SortingParams sortingParameters, final String dstkey) {
runChecks(); runChecks();
client.sort(key, sortingParameters, dstkey); client.sort(key, sortingParameters, dstkey);
@@ -1903,7 +1913,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param dstkey * @param dstkey
* @return The number of elements of the list at dstkey. * @return The number of elements of the list at dstkey.
*/ */
public Integer sort(final String key, final String dstkey) { public Long sort(final String key, final String dstkey) {
runChecks(); runChecks();
client.sort(key, dstkey); client.sort(key, dstkey);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2012,36 +2022,41 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param password * @param password
* @return Status code reply * @return Status code reply
*/ */
public String auth(final String password) { @Override
public String auth(final String password) {
runChecks(); runChecks();
client.auth(password); client.auth(password);
return client.getStatusCodeReply(); return client.getStatusCodeReply();
} }
public List<Object> pipelined(JedisPipeline jedisPipeline) { @Override
public List<Object> pipelined(JedisPipeline jedisPipeline) {
jedisPipeline.setClient(client); jedisPipeline.setClient(client);
jedisPipeline.execute(); jedisPipeline.execute();
return client.getAll(); return client.getAll();
} }
public void subscribe(JedisPubSub jedisPubSub, String... channels) { @Override
public void subscribe(JedisPubSub jedisPubSub, String... channels) {
client.setTimeoutInfinite(); client.setTimeoutInfinite();
jedisPubSub.proceed(client, channels); jedisPubSub.proceed(client, channels);
client.rollbackTimeout(); client.rollbackTimeout();
} }
public Integer publish(String channel, String message) { @Override
public Long publish(String channel, String message) {
client.publish(channel, message); client.publish(channel, message);
return client.getIntegerReply(); return client.getIntegerReply();
} }
public void psubscribe(JedisPubSub jedisPubSub, String... patterns) { @Override
public void psubscribe(JedisPubSub jedisPubSub, String... patterns) {
client.setTimeoutInfinite(); client.setTimeoutInfinite();
jedisPubSub.proceedWithPatterns(client, patterns); jedisPubSub.proceedWithPatterns(client, patterns);
client.rollbackTimeout(); client.rollbackTimeout();
} }
public Integer zcount(final String key, final double min, final double max) { public Long zcount(final String key, final double min, final double max) {
runChecks(); runChecks();
client.zcount(key, min, max); client.zcount(key, min, max);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2336,7 +2351,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* operation * operation
* *
*/ */
public Integer zremrangeByRank(final String key, final int start, public Long zremrangeByRank(final String key, final int start,
final int end) { final int end) {
runChecks(); runChecks();
client.zremrangeByRank(key, start, end); client.zremrangeByRank(key, start, end);
@@ -2357,7 +2372,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @param end * @param end
* @return Integer reply, specifically the number of elements removed. * @return Integer reply, specifically the number of elements removed.
*/ */
public Integer zremrangeByScore(final String key, final double start, public Long zremrangeByScore(final String key, final double start,
final double end) { final double end) {
runChecks(); runChecks();
client.zremrangeByScore(key, start, end); client.zremrangeByScore(key, start, end);
@@ -2402,7 +2417,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zunionstore(final String dstkey, final String... sets) { public Long zunionstore(final String dstkey, final String... sets) {
runChecks(); runChecks();
client.zunionstore(dstkey, sets); client.zunionstore(dstkey, sets);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2447,7 +2462,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zunionstore(final String dstkey, final ZParams params, public Long zunionstore(final String dstkey, final ZParams params,
final String... sets) { final String... sets) {
runChecks(); runChecks();
client.zunionstore(dstkey, params, sets); client.zunionstore(dstkey, params, sets);
@@ -2492,7 +2507,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zinterstore(final String dstkey, final String... sets) { public Long zinterstore(final String dstkey, final String... sets) {
runChecks(); runChecks();
client.zinterstore(dstkey, sets); client.zinterstore(dstkey, sets);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -2537,19 +2552,19 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically the number of elements in the sorted * @return Integer reply, specifically the number of elements in the sorted
* set at dstkey * set at dstkey
*/ */
public Integer zinterstore(final String dstkey, final ZParams params, public Long zinterstore(final String dstkey, final ZParams params,
final String... sets) { final String... sets) {
runChecks(); runChecks();
client.zinterstore(dstkey, params, sets); client.zinterstore(dstkey, params, sets);
return client.getIntegerReply(); return client.getIntegerReply();
} }
public Integer strlen(final String key) { public Long strlen(final String key) {
client.strlen(key); client.strlen(key);
return client.getIntegerReply(); return client.getIntegerReply();
} }
public Integer lpushx(final String key, final String string) { public Long lpushx(final String key, final String string) {
client.lpushx(key, string); client.lpushx(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2564,12 +2579,12 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* @return Integer reply, specifically: 1: the key is now persist. 0: the * @return Integer reply, specifically: 1: the key is now persist. 0: the
* key is not persist (only happens when key not set). * key is not persist (only happens when key not set).
*/ */
public Integer persist(final String key) { public Long persist(final String key) {
client.persist(key); client.persist(key);
return client.getIntegerReply(); return client.getIntegerReply();
} }
public Integer rpushx(final String key, final String string) { public Long rpushx(final String key, final String string) {
client.rpushx(key, string); client.rpushx(key, string);
return client.getIntegerReply(); return client.getIntegerReply();
} }
@@ -2579,7 +2594,7 @@ public class Jedis extends BinaryJedis implements JedisCommands {
return client.getBulkReply(); return client.getBulkReply();
} }
public Integer linsert(final String key, final LIST_POSITION where, public Long linsert(final String key, final LIST_POSITION where,
final String pivot, final String value) { final String pivot, final String value) {
client.linsert(key, where, pivot, value); client.linsert(key, where, pivot, value);
return client.getIntegerReply(); return client.getIntegerReply();

View File

@@ -13,51 +13,51 @@ public interface JedisCommands {
String get(String key); String get(String key);
Integer exists(String key); Long exists(String key);
String type(String key); String type(String key);
Integer expire(String key, int seconds); Long expire(String key, int seconds);
Integer expireAt(String key, long unixTime); Long expireAt(String key, long unixTime);
Integer ttl(String key); Long ttl(String key);
String getSet(String key, String value); String getSet(String key, String value);
Integer setnx(String key, String value); Long setnx(String key, String value);
String setex(String key, int seconds, String value); String setex(String key, int seconds, String value);
Integer decrBy(String key, int integer); Long decrBy(String key, int integer);
Integer decr(String key); Long decr(String key);
Integer incrBy(String key, int integer); Long incrBy(String key, int integer);
Integer incr(String key); Long incr(String key);
Integer append(String key, String value); Long append(String key, String value);
String substr(String key, int start, int end); String substr(String key, int start, int end);
Integer hset(String key, String field, String value); Long hset(String key, String field, String value);
String hget(String key, String field); String hget(String key, String field);
Integer hsetnx(String key, String field, String value); Long hsetnx(String key, String field, String value);
String hmset(String key, Map<String, String> hash); String hmset(String key, Map<String, String> hash);
List<String> hmget(String key, String... fields); List<String> hmget(String key, String... fields);
Integer hincrBy(String key, String field, int value); Long hincrBy(String key, String field, int value);
Integer hexists(String key, String field); Long hexists(String key, String field);
Integer hdel(String key, String field); Long hdel(String key, String field);
Integer hlen(String key); Long hlen(String key);
Set<String> hkeys(String key); Set<String> hkeys(String key);
@@ -65,11 +65,11 @@ public interface JedisCommands {
Map<String, String> hgetAll(String key); Map<String, String> hgetAll(String key);
Integer rpush(String key, String string); Long rpush(String key, String string);
Integer lpush(String key, String string); Long lpush(String key, String string);
Integer llen(String key); Long llen(String key);
List<String> lrange(String key, int start, int end); List<String> lrange(String key, int start, int end);
@@ -79,37 +79,37 @@ public interface JedisCommands {
String lset(String key, int index, String value); String lset(String key, int index, String value);
Integer lrem(String key, int count, String value); Long lrem(String key, int count, String value);
String lpop(String key); String lpop(String key);
String rpop(String key); String rpop(String key);
Integer sadd(String key, String member); Long sadd(String key, String member);
Set<String> smembers(String key); Set<String> smembers(String key);
Integer srem(String key, String member); Long srem(String key, String member);
String spop(String key); String spop(String key);
Integer scard(String key); Long scard(String key);
Integer sismember(String key, String member); Long sismember(String key, String member);
String srandmember(String key); String srandmember(String key);
Integer zadd(String key, double score, String member); Long zadd(String key, double score, String member);
Set<String> zrange(String key, int start, int end); Set<String> zrange(String key, int start, int end);
Integer zrem(String key, String member); Long zrem(String key, String member);
Double zincrby(String key, double score, String member); Double zincrby(String key, double score, String member);
Integer zrank(String key, String member); Long zrank(String key, String member);
Integer zrevrank(String key, String member); Long zrevrank(String key, String member);
Set<String> zrevrange(String key, int start, int end); Set<String> zrevrange(String key, int start, int end);
@@ -117,7 +117,7 @@ public interface JedisCommands {
Set<Tuple> zrevrangeWithScores(String key, int start, int end); Set<Tuple> zrevrangeWithScores(String key, int start, int end);
Integer zcard(String key); Long zcard(String key);
Double zscore(String key, String member); Double zscore(String key, String member);
@@ -125,7 +125,7 @@ public interface JedisCommands {
List<String> sort(String key, SortingParams sortingParameters); List<String> sort(String key, SortingParams sortingParameters);
Integer zcount(String key, double min, double max); Long zcount(String key, double min, double max);
Set<String> zrangeByScore(String key, double min, double max); Set<String> zrangeByScore(String key, double min, double max);
@@ -137,10 +137,10 @@ public interface JedisCommands {
Set<Tuple> zrangeByScoreWithScores(String key, double min, Set<Tuple> zrangeByScoreWithScores(String key, double min,
double max, int offset, int count); double max, int offset, int count);
Integer zremrangeByRank(String key, int start, int end); Long zremrangeByRank(String key, int start, int end);
Integer zremrangeByScore(String key, double start, double end); Long zremrangeByScore(String key, double start, double end);
Integer linsert(String key, Client.LIST_POSITION where, String pivot, Long linsert(String key, Client.LIST_POSITION where, String pivot,
String value); String value);
} }

View File

@@ -78,13 +78,13 @@ public abstract class JedisPubSub {
} }
final byte[] resp = (byte[]) firstObj; final byte[] resp = (byte[]) firstObj;
if (Arrays.equals(SUBSCRIBE.raw, resp)) { if (Arrays.equals(SUBSCRIBE.raw, resp)) {
subscribedChannels = ((Integer) reply.get(2)).intValue(); subscribedChannels = ((Long) reply.get(2)).intValue();
final byte[] bchannel = (byte[]) reply.get(1); final byte[] bchannel = (byte[]) reply.get(1);
final String strchannel = (bchannel == null) ? null final String strchannel = (bchannel == null) ? null
: SafeEncoder.encode(bchannel); : SafeEncoder.encode(bchannel);
onSubscribe(strchannel, subscribedChannels); onSubscribe(strchannel, subscribedChannels);
} else if (Arrays.equals(UNSUBSCRIBE.raw, resp)) { } else if (Arrays.equals(UNSUBSCRIBE.raw, resp)) {
subscribedChannels = ((Integer) reply.get(2)).intValue(); subscribedChannels = ((Long) reply.get(2)).intValue();
final byte[] bchannel = (byte[]) reply.get(1); final byte[] bchannel = (byte[]) reply.get(1);
final String strchannel = (bchannel == null) ? null final String strchannel = (bchannel == null) ? null
: SafeEncoder.encode(bchannel); : SafeEncoder.encode(bchannel);
@@ -109,13 +109,13 @@ public abstract class JedisPubSub {
.encode(bmesg); .encode(bmesg);
onPMessage(strpattern, strchannel, strmesg); onPMessage(strpattern, strchannel, strmesg);
} else if (Arrays.equals(PSUBSCRIBE.raw, resp)) { } else if (Arrays.equals(PSUBSCRIBE.raw, resp)) {
subscribedChannels = ((Integer) reply.get(2)).intValue(); subscribedChannels = ((Long) reply.get(2)).intValue();
final byte[] bpattern = (byte[]) reply.get(1); final byte[] bpattern = (byte[]) reply.get(1);
final String strpattern = (bpattern == null) ? null final String strpattern = (bpattern == null) ? null
: SafeEncoder.encode(bpattern); : SafeEncoder.encode(bpattern);
onPSubscribe(strpattern, subscribedChannels); onPSubscribe(strpattern, subscribedChannels);
} else if (Arrays.equals(PUNSUBSCRIBE.raw, resp)) { } else if (Arrays.equals(PUNSUBSCRIBE.raw, resp)) {
subscribedChannels = ((Integer) reply.get(2)).intValue(); subscribedChannels = ((Long) reply.get(2)).intValue();
final byte[] bpattern = (byte[]) reply.get(1); final byte[] bpattern = (byte[]) reply.get(1);
final String strpattern = (bpattern == null) ? null final String strpattern = (bpattern == null) ? null
: SafeEncoder.encode(bpattern); : SafeEncoder.encode(bpattern);

View File

@@ -100,9 +100,9 @@ public final class Protocol {
return read; return read;
} }
private Integer processInteger(final RedisInputStream is) { private Long processInteger(final RedisInputStream is) {
String num = is.readLine(); String num = is.readLine();
return Integer.valueOf(num); return Long.valueOf(num);
} }
private List<Object> processMultiBulkReply(final RedisInputStream is) { private List<Object> processMultiBulkReply(final RedisInputStream is) {

View File

@@ -28,7 +28,8 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
super(shards, algo, keyTagPattern); super(shards, algo, keyTagPattern);
} }
public void disconnect() throws IOException { @Override
public void disconnect() throws IOException {
for (Jedis jedis : getAllShards()) { for (Jedis jedis : getAllShards()) {
jedis.quit(); jedis.quit();
jedis.disconnect(); jedis.disconnect();
@@ -45,7 +46,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.get(key); return j.get(key);
} }
public Integer exists(String key) { public Long exists(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.exists(key); return j.exists(key);
} }
@@ -55,17 +56,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.type(key); return j.type(key);
} }
public Integer expire(String key, int seconds) { public Long expire(String key, int seconds) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.expire(key, seconds); return j.expire(key, seconds);
} }
public Integer expireAt(String key, long unixTime) { public Long expireAt(String key, long unixTime) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.expireAt(key, unixTime); return j.expireAt(key, unixTime);
} }
public Integer ttl(String key) { public Long ttl(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.ttl(key); return j.ttl(key);
} }
@@ -75,7 +76,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.getSet(key, value); return j.getSet(key, value);
} }
public Integer setnx(String key, String value) { public Long setnx(String key, String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.setnx(key, value); return j.setnx(key, value);
} }
@@ -85,27 +86,27 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.setex(key, seconds, value); return j.setex(key, seconds, value);
} }
public Integer decrBy(String key, int integer) { public Long decrBy(String key, int integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decrBy(key, integer); return j.decrBy(key, integer);
} }
public Integer decr(String key) { public Long decr(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decr(key); return j.decr(key);
} }
public Integer incrBy(String key, int integer) { public Long incrBy(String key, int integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incrBy(key, integer); return j.incrBy(key, integer);
} }
public Integer incr(String key) { public Long incr(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incr(key); return j.incr(key);
} }
public Integer append(String key, String value) { public Long append(String key, String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.append(key, value); return j.append(key, value);
} }
@@ -115,7 +116,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.substr(key, start, end); return j.substr(key, start, end);
} }
public Integer hset(String key, String field, String value) { public Long hset(String key, String field, String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hset(key, field, value); return j.hset(key, field, value);
} }
@@ -125,7 +126,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.hget(key, field); return j.hget(key, field);
} }
public Integer hsetnx(String key, String field, String value) { public Long hsetnx(String key, String field, String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hsetnx(key, field, value); return j.hsetnx(key, field, value);
} }
@@ -140,22 +141,22 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.hmget(key, fields); return j.hmget(key, fields);
} }
public Integer hincrBy(String key, String field, int value) { public Long hincrBy(String key, String field, int value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hincrBy(key, field, value); return j.hincrBy(key, field, value);
} }
public Integer hexists(String key, String field) { public Long hexists(String key, String field) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hexists(key, field); return j.hexists(key, field);
} }
public Integer hdel(String key, String field) { public Long hdel(String key, String field) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hdel(key, field); return j.hdel(key, field);
} }
public Integer hlen(String key) { public Long hlen(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hlen(key); return j.hlen(key);
} }
@@ -175,17 +176,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.hgetAll(key); return j.hgetAll(key);
} }
public Integer rpush(String key, String string) { public Long rpush(String key, String string) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.rpush(key, string); return j.rpush(key, string);
} }
public Integer lpush(String key, String string) { public Long lpush(String key, String string) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.lpush(key, string); return j.lpush(key, string);
} }
public Integer llen(String key) { public Long llen(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.llen(key); return j.llen(key);
} }
@@ -210,7 +211,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.lset(key, index, value); return j.lset(key, index, value);
} }
public Integer lrem(String key, int count, String value) { public Long lrem(String key, int count, String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.lrem(key, count, value); return j.lrem(key, count, value);
} }
@@ -225,7 +226,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.rpop(key); return j.rpop(key);
} }
public Integer sadd(String key, String member) { public Long sadd(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.sadd(key, member); return j.sadd(key, member);
} }
@@ -235,7 +236,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.smembers(key); return j.smembers(key);
} }
public Integer srem(String key, String member) { public Long srem(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.srem(key, member); return j.srem(key, member);
} }
@@ -245,12 +246,12 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.spop(key); return j.spop(key);
} }
public Integer scard(String key) { public Long scard(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.scard(key); return j.scard(key);
} }
public Integer sismember(String key, String member) { public Long sismember(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.sismember(key, member); return j.sismember(key, member);
} }
@@ -260,7 +261,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.srandmember(key); return j.srandmember(key);
} }
public Integer zadd(String key, double score, String member) { public Long zadd(String key, double score, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zadd(key, score, member); return j.zadd(key, score, member);
} }
@@ -270,7 +271,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.zrange(key, start, end); return j.zrange(key, start, end);
} }
public Integer zrem(String key, String member) { public Long zrem(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrem(key, member); return j.zrem(key, member);
} }
@@ -280,12 +281,12 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.zincrby(key, score, member); return j.zincrby(key, score, member);
} }
public Integer zrank(String key, String member) { public Long zrank(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrank(key, member); return j.zrank(key, member);
} }
public Integer zrevrank(String key, String member) { public Long zrevrank(String key, String member) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zrevrank(key, member); return j.zrevrank(key, member);
} }
@@ -305,7 +306,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.zrevrangeWithScores(key, start, end); return j.zrevrangeWithScores(key, start, end);
} }
public Integer zcard(String key) { public Long zcard(String key) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zcard(key); return j.zcard(key);
} }
@@ -325,7 +326,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.sort(key, sortingParameters); return j.sort(key, sortingParameters);
} }
public Integer zcount(String key, double min, double max) { public Long zcount(String key, double min, double max) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zcount(key, min, max); return j.zcount(key, min, max);
} }
@@ -352,17 +353,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.zrangeByScoreWithScores(key, min, max, offset, count); return j.zrangeByScoreWithScores(key, min, max, offset, count);
} }
public Integer zremrangeByRank(String key, int start, int end) { public Long zremrangeByRank(String key, int start, int end) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zremrangeByRank(key, start, end); return j.zremrangeByRank(key, start, end);
} }
public Integer zremrangeByScore(String key, double start, double end) { public Long zremrangeByScore(String key, double start, double end) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.zremrangeByScore(key, start, end); return j.zremrangeByScore(key, start, end);
} }
public Integer linsert(String key, LIST_POSITION where, String pivot, public Long linsert(String key, LIST_POSITION where, String pivot,
String value) { String value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.linsert(key, where, pivot, value); return j.linsert(key, where, pivot, value);

View File

@@ -77,7 +77,7 @@ public class ProtocolTest extends JedisTestBase {
public void integerReply() { public void integerReply() {
InputStream is = new ByteArrayInputStream(":123\r\n".getBytes()); InputStream is = new ByteArrayInputStream(":123\r\n".getBytes());
Protocol protocol = new Protocol(); Protocol protocol = new Protocol();
int response = (Integer) protocol.read(new RedisInputStream(is)); long response = (Long) protocol.read(new RedisInputStream(is));
assertEquals(123, response); assertEquals(123, response);
} }

View File

@@ -37,7 +37,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
status = jedis.set(bfoo, bbar); status = jedis.set(bfoo, bbar);
assertEquals("OK", status); assertEquals("OK", status);
int reply = jedis.exists("foo"); long reply = jedis.exists("foo");
assertEquals(1, reply); assertEquals(1, reply);
reply = jedis.exists(bfoo); reply = jedis.exists(bfoo);
@@ -62,7 +62,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
jedis.set("foo2", "bar2"); jedis.set("foo2", "bar2");
jedis.set("foo3", "bar3"); jedis.set("foo3", "bar3");
int reply = jedis.del("foo1", "foo2", "foo3"); long reply = jedis.del("foo1", "foo2", "foo3");
assertEquals(3, reply); assertEquals(3, reply);
reply = jedis.exists("foo1"); reply = jedis.exists("foo1");
@@ -222,7 +222,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void renamenx() { public void renamenx() {
jedis.set("foo", "bar"); jedis.set("foo", "bar");
int status = jedis.renamenx("foo", "bar"); long status = jedis.renamenx("foo", "bar");
assertEquals(1, status); assertEquals(1, status);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -231,7 +231,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
// Binary // Binary
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
int bstatus = jedis.renamenx(bfoo, bbar); long bstatus = jedis.renamenx(bfoo, bbar);
assertEquals(1, bstatus); assertEquals(1, bstatus);
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
@@ -242,7 +242,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void dbSize() { public void dbSize() {
int size = jedis.dbSize(); long size = jedis.dbSize();
assertEquals(0, size); assertEquals(0, size);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -257,7 +257,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void expire() { public void expire() {
int status = jedis.expire("foo", 20); long status = jedis.expire("foo", 20);
assertEquals(0, status); assertEquals(0, status);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -265,7 +265,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
assertEquals(1, status); assertEquals(1, status);
// Binary // Binary
int bstatus = jedis.expire(bfoo, 20); long bstatus = jedis.expire(bfoo, 20);
assertEquals(0, bstatus); assertEquals(0, bstatus);
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
@@ -278,7 +278,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
public void expireAt() { public void expireAt() {
long unixTime = (System.currentTimeMillis() / 1000L) + 20; long unixTime = (System.currentTimeMillis() / 1000L) + 20;
int status = jedis.expireAt("foo", unixTime); long status = jedis.expireAt("foo", unixTime);
assertEquals(0, status); assertEquals(0, status);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -287,7 +287,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
assertEquals(1, status); assertEquals(1, status);
// Binary // Binary
int bstatus = jedis.expireAt(bfoo, unixTime); long bstatus = jedis.expireAt(bfoo, unixTime);
assertEquals(0, bstatus); assertEquals(0, bstatus);
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
@@ -299,7 +299,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void ttl() { public void ttl() {
int ttl = jedis.ttl("foo"); long ttl = jedis.ttl("foo");
assertEquals(-1, ttl); assertEquals(-1, ttl);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -311,7 +311,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
assertTrue(ttl >= 0 && ttl <= 20); assertTrue(ttl >= 0 && ttl <= 20);
// Binary // Binary
int bttl = jedis.ttl(bfoo); long bttl = jedis.ttl(bfoo);
assertEquals(-1, bttl); assertEquals(-1, bttl);
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
@@ -345,7 +345,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void move() { public void move() {
int status = jedis.move("foo", 1); long status = jedis.move("foo", 1);
assertEquals(0, status); assertEquals(0, status);
jedis.set("foo", "bar"); jedis.set("foo", "bar");
@@ -358,7 +358,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
// Binary // Binary
jedis.select(0); jedis.select(0);
int bstatus = jedis.move(bfoo, 1); long bstatus = jedis.move(bfoo, 1);
assertEquals(0, bstatus); assertEquals(0, bstatus);
jedis.set(bfoo, bbar); jedis.set(bfoo, bbar);
@@ -428,14 +428,14 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
public void persist() { public void persist() {
jedis.setex("foo", 60 * 60, "bar"); jedis.setex("foo", 60 * 60, "bar");
assertTrue(jedis.ttl("foo") > 0); assertTrue(jedis.ttl("foo") > 0);
int status = jedis.persist("foo"); long status = jedis.persist("foo");
assertEquals(1, status); assertEquals(1, status);
assertEquals(-1, jedis.ttl("foo").intValue()); assertEquals(-1, jedis.ttl("foo").intValue());
// Binary // Binary
jedis.setex(bfoo, 60 * 60, bbar); jedis.setex(bfoo, 60 * 60, bbar);
assertTrue(jedis.ttl(bfoo) > 0); assertTrue(jedis.ttl(bfoo) > 0);
int bstatus = jedis.persist(bfoo); long bstatus = jedis.persist(bfoo);
assertEquals(1, bstatus); assertEquals(1, bstatus);
assertEquals(-1, jedis.ttl(bfoo).intValue()); assertEquals(-1, jedis.ttl(bfoo).intValue());

View File

@@ -75,7 +75,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void setnx() { public void setnx() {
int status = jedis.setnx(bfoo, binaryValue); long status = jedis.setnx(bfoo, binaryValue);
assertEquals(1, status); assertEquals(1, status);
assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo))); assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo)));
@@ -88,7 +88,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
public void setex() { public void setex() {
String status = jedis.setex(bfoo, 20, binaryValue); String status = jedis.setex(bfoo, 20, binaryValue);
assertEquals(Keyword.OK.name(), status); assertEquals(Keyword.OK.name(), status);
int ttl = jedis.ttl(bfoo); long ttl = jedis.ttl(bfoo);
assertTrue(ttl > 0 && ttl <= 20); assertTrue(ttl > 0 && ttl <= 20);
} }
@@ -102,7 +102,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void msetnx() { public void msetnx() {
int status = jedis.msetnx(bfoo, binaryValue, bbar, bfoo); long status = jedis.msetnx(bfoo, binaryValue, bbar, bfoo);
assertEquals(1, status); assertEquals(1, status);
assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo))); assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo)));
assertTrue(Arrays.equals(bfoo, jedis.get(bbar))); assertTrue(Arrays.equals(bfoo, jedis.get(bbar)));
@@ -121,7 +121,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void incr() { public void incr() {
int value = jedis.incr(bfoo); long value = jedis.incr(bfoo);
assertEquals(1, value); assertEquals(1, value);
value = jedis.incr(bfoo); value = jedis.incr(bfoo);
assertEquals(2, value); assertEquals(2, value);
@@ -135,7 +135,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void incrBy() { public void incrBy() {
int value = jedis.incrBy(bfoo, 2); long value = jedis.incrBy(bfoo, 2);
assertEquals(2, value); assertEquals(2, value);
value = jedis.incrBy(bfoo, 2); value = jedis.incrBy(bfoo, 2);
assertEquals(4, value); assertEquals(4, value);
@@ -149,7 +149,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void decr() { public void decr() {
int value = jedis.decr(bfoo); long value = jedis.decr(bfoo);
assertEquals(-1, value); assertEquals(-1, value);
value = jedis.decr(bfoo); value = jedis.decr(bfoo);
assertEquals(-2, value); assertEquals(-2, value);
@@ -163,7 +163,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void decrBy() { public void decrBy() {
int value = jedis.decrBy(bfoo, 2); long value = jedis.decrBy(bfoo, 2);
assertEquals(-2, value); assertEquals(-2, value);
value = jedis.decrBy(bfoo, 2); value = jedis.decrBy(bfoo, 2);
assertEquals(-4, value); assertEquals(-4, value);
@@ -173,7 +173,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase {
public void append() { public void append() {
byte[] first512 = new byte[512]; byte[] first512 = new byte[512];
System.arraycopy(binaryValue, 0, first512, 0, 512); System.arraycopy(binaryValue, 0, first512, 0, 512);
int value = jedis.append(bfoo, first512); long value = jedis.append(bfoo, first512);
assertEquals(512, value); assertEquals(512, value);
assertTrue(Arrays.equals(first512, jedis.get(bfoo))); assertTrue(Arrays.equals(first512, jedis.get(bfoo)));

View File

@@ -35,7 +35,7 @@ public class ControlCommandsTest extends JedisCommandTestBase {
@Test @Test
public void lastsave() throws InterruptedException { public void lastsave() throws InterruptedException {
int before = jedis.lastsave(); long before = jedis.lastsave();
String st = ""; String st = "";
while (!st.equals("OK")) { while (!st.equals("OK")) {
try { try {
@@ -45,7 +45,7 @@ public class ControlCommandsTest extends JedisCommandTestBase {
} }
} }
int after = jedis.lastsave(); long after = jedis.lastsave();
assertTrue((after - before) > 0); assertTrue((after - before) > 0);
} }
@@ -58,7 +58,8 @@ public class ControlCommandsTest extends JedisCommandTestBase {
@Test @Test
public void monitor() { public void monitor() {
jedis.monitor(new JedisMonitor() { jedis.monitor(new JedisMonitor() {
public void onCommand(String command) { @Override
public void onCommand(String command) {
assertTrue(command.contains("OK")); assertTrue(command.contains("OK"));
client.disconnect(); client.disconnect();
} }

View File

@@ -17,13 +17,13 @@ public class HashesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void hset() { public void hset() {
int status = jedis.hset("foo", "bar", "car"); long status = jedis.hset("foo", "bar", "car");
assertEquals(1, status); assertEquals(1, status);
status = jedis.hset("foo", "bar", "foo"); status = jedis.hset("foo", "bar", "foo");
assertEquals(0, status); assertEquals(0, status);
// Binary // Binary
int bstatus = jedis.hset(bfoo, bbar, bcar); long bstatus = jedis.hset(bfoo, bbar, bcar);
assertEquals(1, bstatus); assertEquals(1, bstatus);
bstatus = jedis.hset(bfoo, bbar, bfoo); bstatus = jedis.hset(bfoo, bbar, bfoo);
assertEquals(0, bstatus); assertEquals(0, bstatus);
@@ -46,7 +46,7 @@ public class HashesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void hsetnx() { public void hsetnx() {
int status = jedis.hsetnx("foo", "bar", "car"); long status = jedis.hsetnx("foo", "bar", "car");
assertEquals(1, status); assertEquals(1, status);
assertEquals("car", jedis.hget("foo", "bar")); assertEquals("car", jedis.hget("foo", "bar"));
@@ -59,7 +59,7 @@ public class HashesCommandsTest extends JedisCommandTestBase {
assertEquals("bar", jedis.hget("foo", "car")); assertEquals("bar", jedis.hget("foo", "car"));
// Binary // Binary
int bstatus = jedis.hsetnx(bfoo, bbar, bcar); long bstatus = jedis.hsetnx(bfoo, bbar, bcar);
assertEquals(1, bstatus); assertEquals(1, bstatus);
assertArrayEquals(bcar, jedis.hget(bfoo, bbar)); assertArrayEquals(bcar, jedis.hget(bfoo, bbar));
@@ -126,7 +126,7 @@ public class HashesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void hincrBy() { public void hincrBy() {
int value = jedis.hincrBy("foo", "bar", 1); long value = jedis.hincrBy("foo", "bar", 1);
assertEquals(1, value); assertEquals(1, value);
value = jedis.hincrBy("foo", "bar", -1); value = jedis.hincrBy("foo", "bar", -1);
assertEquals(0, value); assertEquals(0, value);
@@ -134,7 +134,7 @@ public class HashesCommandsTest extends JedisCommandTestBase {
assertEquals(-10, value); assertEquals(-10, value);
// Binary // Binary
int bvalue = jedis.hincrBy(bfoo, bbar, 1); long bvalue = jedis.hincrBy(bfoo, bbar, 1);
assertEquals(1, bvalue); assertEquals(1, bvalue);
bvalue = jedis.hincrBy(bfoo, bbar, -1); bvalue = jedis.hincrBy(bfoo, bbar, -1);
assertEquals(0, bvalue); assertEquals(0, bvalue);

View File

@@ -25,13 +25,13 @@ public class ListCommandsTest extends JedisCommandTestBase {
@Test @Test
public void rpush() { public void rpush() {
int size = jedis.rpush("foo", "bar"); long size = jedis.rpush("foo", "bar");
assertEquals(1, size); assertEquals(1, size);
size = jedis.rpush("foo", "foo"); size = jedis.rpush("foo", "foo");
assertEquals(2, size); assertEquals(2, size);
// Binary // Binary
int bsize = jedis.rpush(bfoo, bbar); long bsize = jedis.rpush(bfoo, bbar);
assertEquals(1, bsize); assertEquals(1, bsize);
bsize = jedis.rpush(bfoo, bfoo); bsize = jedis.rpush(bfoo, bfoo);
assertEquals(2, bsize); assertEquals(2, bsize);
@@ -40,13 +40,13 @@ public class ListCommandsTest extends JedisCommandTestBase {
@Test @Test
public void lpush() { public void lpush() {
int size = jedis.lpush("foo", "bar"); long size = jedis.lpush("foo", "bar");
assertEquals(1, size); assertEquals(1, size);
size = jedis.lpush("foo", "foo"); size = jedis.lpush("foo", "foo");
assertEquals(2, size); assertEquals(2, size);
// Binary // Binary
int bsize = jedis.lpush(bfoo, bbar); long bsize = jedis.lpush(bfoo, bbar);
assertEquals(1, bsize); assertEquals(1, bsize);
bsize = jedis.lpush(bfoo, bfoo); bsize = jedis.lpush(bfoo, bfoo);
assertEquals(2, bsize); assertEquals(2, bsize);
@@ -236,7 +236,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
jedis.lpush("foo", "b"); jedis.lpush("foo", "b");
jedis.lpush("foo", "a"); jedis.lpush("foo", "a");
int count = jedis.lrem("foo", -2, "hello"); long count = jedis.lrem("foo", -2, "hello");
List<String> expected = new ArrayList<String>(); List<String> expected = new ArrayList<String>();
expected.add("a"); expected.add("a");
@@ -258,7 +258,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
jedis.lpush(bfoo, bB); jedis.lpush(bfoo, bB);
jedis.lpush(bfoo, bA); jedis.lpush(bfoo, bA);
int bcount = jedis.lrem(bfoo, -2, bhello); long bcount = jedis.lrem(bfoo, -2, bhello);
List<byte[]> bexpected = new ArrayList<byte[]>(); List<byte[]> bexpected = new ArrayList<byte[]>();
bexpected.add(bA); bexpected.add(bA);
@@ -502,7 +502,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
@Test @Test
public void lpushx() { public void lpushx() {
int status = jedis.lpushx("foo", "bar"); long status = jedis.lpushx("foo", "bar");
assertEquals(0, status); assertEquals(0, status);
jedis.lpush("foo", "a"); jedis.lpush("foo", "a");
@@ -510,7 +510,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
assertEquals(2, status); assertEquals(2, status);
// Binary // Binary
int bstatus = jedis.lpushx(bfoo, bbar); long bstatus = jedis.lpushx(bfoo, bbar);
assertEquals(0, bstatus); assertEquals(0, bstatus);
jedis.lpush(bfoo, bA); jedis.lpush(bfoo, bA);
@@ -521,7 +521,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
@Test @Test
public void rpushx() { public void rpushx() {
int status = jedis.rpushx("foo", "bar"); long status = jedis.rpushx("foo", "bar");
assertEquals(0, status); assertEquals(0, status);
jedis.lpush("foo", "a"); jedis.lpush("foo", "a");
@@ -529,7 +529,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
assertEquals(2, status); assertEquals(2, status);
// Binary // Binary
int bstatus = jedis.rpushx(bfoo, bbar); long bstatus = jedis.rpushx(bfoo, bbar);
assertEquals(0, bstatus); assertEquals(0, bstatus);
jedis.lpush(bfoo, bA); jedis.lpush(bfoo, bA);
@@ -539,7 +539,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
@Test @Test
public void linsert() { public void linsert() {
int status = jedis.linsert("foo", Client.LIST_POSITION.BEFORE, "bar", long status = jedis.linsert("foo", Client.LIST_POSITION.BEFORE, "bar",
"car"); "car");
assertEquals(0, status); assertEquals(0, status);
@@ -559,7 +559,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
assertEquals(-1, status); assertEquals(-1, status);
// Binary // Binary
int bstatus = jedis.linsert(bfoo, Client.LIST_POSITION.BEFORE, bbar, long bstatus = jedis.linsert(bfoo, Client.LIST_POSITION.BEFORE, bbar,
bcar); bcar);
assertEquals(0, bstatus); assertEquals(0, bstatus);

View File

@@ -18,13 +18,13 @@ public class SetCommandsTest extends JedisCommandTestBase {
@Test @Test
public void sadd() { public void sadd() {
int status = jedis.sadd("foo", "a"); long status = jedis.sadd("foo", "a");
assertEquals(1, status); assertEquals(1, status);
status = jedis.sadd("foo", "a"); status = jedis.sadd("foo", "a");
assertEquals(0, status); assertEquals(0, status);
int bstatus = jedis.sadd(bfoo, ba); long bstatus = jedis.sadd(bfoo, ba);
assertEquals(1, bstatus); assertEquals(1, bstatus);
bstatus = jedis.sadd(bfoo, ba); bstatus = jedis.sadd(bfoo, ba);
@@ -63,7 +63,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd("foo", "a"); jedis.sadd("foo", "a");
jedis.sadd("foo", "b"); jedis.sadd("foo", "b");
int status = jedis.srem("foo", "a"); long status = jedis.srem("foo", "a");
Set<String> expected = new LinkedHashSet<String>(); Set<String> expected = new LinkedHashSet<String>();
expected.add("b"); expected.add("b");
@@ -80,7 +80,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd(bfoo, ba); jedis.sadd(bfoo, ba);
jedis.sadd(bfoo, bb); jedis.sadd(bfoo, bb);
int bstatus = jedis.srem(bfoo, ba); long bstatus = jedis.srem(bfoo, ba);
Set<byte[]> bexpected = new LinkedHashSet<byte[]>(); Set<byte[]> bexpected = new LinkedHashSet<byte[]>();
bexpected.add(bb); bexpected.add(bb);
@@ -128,7 +128,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd("bar", "c"); jedis.sadd("bar", "c");
int status = jedis.smove("foo", "bar", "a"); long status = jedis.smove("foo", "bar", "a");
Set<String> expectedSrc = new LinkedHashSet<String>(); Set<String> expectedSrc = new LinkedHashSet<String>();
expectedSrc.add("b"); expectedSrc.add("b");
@@ -151,7 +151,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd(bbar, bc); jedis.sadd(bbar, bc);
int bstatus = jedis.smove(bfoo, bbar, ba); long bstatus = jedis.smove(bfoo, bbar, ba);
Set<byte[]> bexpectedSrc = new LinkedHashSet<byte[]>(); Set<byte[]> bexpectedSrc = new LinkedHashSet<byte[]>();
bexpectedSrc.add(bb); bexpectedSrc.add(bb);
@@ -174,7 +174,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd("foo", "a"); jedis.sadd("foo", "a");
jedis.sadd("foo", "b"); jedis.sadd("foo", "b");
int card = jedis.scard("foo"); long card = jedis.scard("foo");
assertEquals(2, card); assertEquals(2, card);
@@ -185,7 +185,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd(bfoo, ba); jedis.sadd(bfoo, ba);
jedis.sadd(bfoo, bb); jedis.sadd(bfoo, bb);
int bcard = jedis.scard(bfoo); long bcard = jedis.scard(bfoo);
assertEquals(2, bcard); assertEquals(2, bcard);
@@ -199,7 +199,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd("foo", "a"); jedis.sadd("foo", "a");
jedis.sadd("foo", "b"); jedis.sadd("foo", "b");
int status = jedis.sismember("foo", "a"); long status = jedis.sismember("foo", "a");
assertEquals(1, status); assertEquals(1, status);
status = jedis.sismember("foo", "c"); status = jedis.sismember("foo", "c");
@@ -209,7 +209,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
jedis.sadd(bfoo, ba); jedis.sadd(bfoo, ba);
jedis.sadd(bfoo, bb); jedis.sadd(bfoo, bb);
int bstatus = jedis.sismember(bfoo, ba); long bstatus = jedis.sismember(bfoo, ba);
assertEquals(1, bstatus); assertEquals(1, bstatus);
bstatus = jedis.sismember(bfoo, bc); bstatus = jedis.sismember(bfoo, bc);
@@ -256,7 +256,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
Set<String> expected = new LinkedHashSet<String>(); Set<String> expected = new LinkedHashSet<String>();
expected.add("b"); expected.add("b");
int status = jedis.sinterstore("car", "foo", "bar"); long status = jedis.sinterstore("car", "foo", "bar");
assertEquals(1, status); assertEquals(1, status);
assertEquals(expected, jedis.smembers("car")); assertEquals(expected, jedis.smembers("car"));
@@ -271,7 +271,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
Set<byte[]> bexpected = new LinkedHashSet<byte[]>(); Set<byte[]> bexpected = new LinkedHashSet<byte[]>();
bexpected.add(bb); bexpected.add(bb);
int bstatus = jedis.sinterstore(bcar, bfoo, bbar); long bstatus = jedis.sinterstore(bcar, bfoo, bbar);
assertEquals(1, bstatus); assertEquals(1, bstatus);
assertEquals(bexpected, jedis.smembers(bcar)); assertEquals(bexpected, jedis.smembers(bcar));
@@ -324,7 +324,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
expected.add("b"); expected.add("b");
expected.add("c"); expected.add("c");
int status = jedis.sunionstore("car", "foo", "bar"); long status = jedis.sunionstore("car", "foo", "bar");
assertEquals(3, status); assertEquals(3, status);
assertEquals(expected, jedis.smembers("car")); assertEquals(expected, jedis.smembers("car"));
@@ -341,7 +341,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
bexpected.add(bc); bexpected.add(bc);
bexpected.add(ba); bexpected.add(ba);
int bstatus = jedis.sunionstore(bcar, bfoo, bbar); long bstatus = jedis.sunionstore(bcar, bfoo, bbar);
assertEquals(3, bstatus); assertEquals(3, bstatus);
assertEquals(bexpected, jedis.smembers(bcar)); assertEquals(bexpected, jedis.smembers(bcar));
@@ -403,7 +403,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
expected.add("d"); expected.add("d");
expected.add("a"); expected.add("a");
int status = jedis.sdiffstore("tar", "foo", "bar", "car"); long status = jedis.sdiffstore("tar", "foo", "bar", "car");
assertEquals(2, status); assertEquals(2, status);
assertEquals(expected, jedis.smembers("car")); assertEquals(expected, jedis.smembers("car"));
@@ -422,7 +422,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
bexpected.add(bd); bexpected.add(bd);
bexpected.add(ba); bexpected.add(ba);
int bstatus = jedis.sdiffstore("tar".getBytes(), bfoo, bbar, bcar); long bstatus = jedis.sdiffstore("tar".getBytes(), bfoo, bbar, bcar);
assertEquals(2, bstatus); assertEquals(2, bstatus);
assertEquals(bexpected, jedis.smembers(bcar)); assertEquals(bexpected, jedis.smembers(bcar));

View File

@@ -19,7 +19,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
@Test @Test
public void zadd() { public void zadd() {
int status = jedis.zadd("foo", 1d, "a"); long status = jedis.zadd("foo", 1d, "a");
assertEquals(1, status); assertEquals(1, status);
status = jedis.zadd("foo", 10d, "b"); status = jedis.zadd("foo", 10d, "b");
@@ -32,7 +32,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
assertEquals(0, status); assertEquals(0, status);
// Binary // Binary
int bstatus = jedis.zadd(bfoo, 1d, ba); long bstatus = jedis.zadd(bfoo, 1d, ba);
assertEquals(1, bstatus); assertEquals(1, bstatus);
bstatus = jedis.zadd(bfoo, 10d, bb); bstatus = jedis.zadd(bfoo, 10d, bb);
@@ -125,7 +125,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 1d, "a");
jedis.zadd("foo", 2d, "b"); jedis.zadd("foo", 2d, "b");
int status = jedis.zrem("foo", "a"); long status = jedis.zrem("foo", "a");
Set<String> expected = new LinkedHashSet<String>(); Set<String> expected = new LinkedHashSet<String>();
expected.add("b"); expected.add("b");
@@ -141,7 +141,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 1d, ba);
jedis.zadd(bfoo, 2d, bb); jedis.zadd(bfoo, 2d, bb);
int bstatus = jedis.zrem(bfoo, ba); long bstatus = jedis.zrem(bfoo, ba);
Set<byte[]> bexpected = new LinkedHashSet<byte[]>(); Set<byte[]> bexpected = new LinkedHashSet<byte[]>();
bexpected.add(bb); bexpected.add(bb);
@@ -189,27 +189,25 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 1d, "a");
jedis.zadd("foo", 2d, "b"); jedis.zadd("foo", 2d, "b");
Integer rank = jedis.zrank("foo", "a"); long rank = jedis.zrank("foo", "a");
assertEquals(0, rank.intValue()); assertEquals(0, rank);
rank = jedis.zrank("foo", "b"); rank = jedis.zrank("foo", "b");
assertEquals(1, rank.intValue()); assertEquals(1, rank);
rank = jedis.zrank("car", "b"); assertNull(jedis.zrank("car", "b"));
assertNull(rank);
// Binary // Binary
jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 1d, ba);
jedis.zadd(bfoo, 2d, bb); jedis.zadd(bfoo, 2d, bb);
Integer brank = jedis.zrank(bfoo, ba); long brank = jedis.zrank(bfoo, ba);
assertEquals(0, brank.intValue()); assertEquals(0, brank);
brank = jedis.zrank(bfoo, bb); brank = jedis.zrank(bfoo, bb);
assertEquals(1, brank.intValue()); assertEquals(1, brank);
brank = jedis.zrank(bcar, bb); assertNull(jedis.zrank(bcar, bb));
assertNull(brank);
} }
@@ -218,7 +216,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 1d, "a");
jedis.zadd("foo", 2d, "b"); jedis.zadd("foo", 2d, "b");
int rank = jedis.zrevrank("foo", "a"); long rank = jedis.zrevrank("foo", "a");
assertEquals(1, rank); assertEquals(1, rank);
rank = jedis.zrevrank("foo", "b"); rank = jedis.zrevrank("foo", "b");
@@ -228,7 +226,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 1d, ba);
jedis.zadd(bfoo, 2d, bb); jedis.zadd(bfoo, 2d, bb);
int brank = jedis.zrevrank(bfoo, ba); long brank = jedis.zrevrank(bfoo, ba);
assertEquals(1, brank); assertEquals(1, brank);
brank = jedis.zrevrank(bfoo, bb); brank = jedis.zrevrank(bfoo, bb);
@@ -317,7 +315,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 0.1d, "c");
jedis.zadd("foo", 2d, "a"); jedis.zadd("foo", 2d, "a");
int size = jedis.zcard("foo"); long size = jedis.zcard("foo");
assertEquals(3, size); assertEquals(3, size);
// Binary // Binary
@@ -326,7 +324,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 0.1d, bc);
jedis.zadd(bfoo, 2d, ba); jedis.zadd(bfoo, 2d, ba);
int bsize = jedis.zcard(bfoo); long bsize = jedis.zcard(bfoo);
assertEquals(3, bsize); assertEquals(3, bsize);
} }
@@ -371,7 +369,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 0.1d, "c");
jedis.zadd("foo", 2d, "a"); jedis.zadd("foo", 2d, "a");
int result = jedis.zcount("foo", 0.01d, 2.1d); long result = jedis.zcount("foo", 0.01d, 2.1d);
assertEquals(2, result); assertEquals(2, result);
@@ -381,7 +379,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 0.1d, bc);
jedis.zadd(bfoo, 2d, ba); jedis.zadd(bfoo, 2d, ba);
int bresult = jedis.zcount(bfoo, 0.01d, 2.1d); long bresult = jedis.zcount(bfoo, 0.01d, 2.1d);
assertEquals(2, bresult); assertEquals(2, bresult);
@@ -518,7 +516,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 0.1d, "c");
jedis.zadd("foo", 2d, "a"); jedis.zadd("foo", 2d, "a");
int result = jedis.zremrangeByRank("foo", 0, 0); long result = jedis.zremrangeByRank("foo", 0, 0);
assertEquals(1, result); assertEquals(1, result);
@@ -534,7 +532,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 0.1d, bc);
jedis.zadd(bfoo, 2d, ba); jedis.zadd(bfoo, 2d, ba);
int bresult = jedis.zremrangeByRank(bfoo, 0, 0); long bresult = jedis.zremrangeByRank(bfoo, 0, 0);
assertEquals(1, bresult); assertEquals(1, bresult);
@@ -553,7 +551,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 0.1d, "c");
jedis.zadd("foo", 2d, "a"); jedis.zadd("foo", 2d, "a");
int result = jedis.zremrangeByScore("foo", 0, 2); long result = jedis.zremrangeByScore("foo", 0, 2);
assertEquals(2, result); assertEquals(2, result);
@@ -568,7 +566,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 0.1d, bc);
jedis.zadd(bfoo, 2d, ba); jedis.zadd(bfoo, 2d, ba);
int bresult = jedis.zremrangeByScore(bfoo, 0, 2); long bresult = jedis.zremrangeByScore(bfoo, 0, 2);
assertEquals(2, bresult); assertEquals(2, bresult);
@@ -585,7 +583,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("bar", 2, "a"); jedis.zadd("bar", 2, "a");
jedis.zadd("bar", 2, "b"); jedis.zadd("bar", 2, "b");
int result = jedis.zunionstore("dst", "foo", "bar"); long result = jedis.zunionstore("dst", "foo", "bar");
assertEquals(2, result); assertEquals(2, result);
@@ -601,7 +599,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bbar, 2, ba); jedis.zadd(bbar, 2, ba);
jedis.zadd(bbar, 2, bb); jedis.zadd(bbar, 2, bb);
int bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bfoo, bbar); long bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bfoo, bbar);
assertEquals(2, bresult); assertEquals(2, bresult);
@@ -623,7 +621,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
ZParams params = new ZParams(); ZParams params = new ZParams();
params.weights(2, 2); params.weights(2, 2);
params.aggregate(ZParams.Aggregate.SUM); params.aggregate(ZParams.Aggregate.SUM);
int result = jedis.zunionstore("dst", params, "foo", "bar"); long result = jedis.zunionstore("dst", params, "foo", "bar");
assertEquals(2, result); assertEquals(2, result);
@@ -642,7 +640,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
ZParams bparams = new ZParams(); ZParams bparams = new ZParams();
bparams.weights(2, 2); bparams.weights(2, 2);
bparams.aggregate(ZParams.Aggregate.SUM); bparams.aggregate(ZParams.Aggregate.SUM);
int bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bparams, long bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bparams,
bfoo, bbar); bfoo, bbar);
assertEquals(2, bresult); assertEquals(2, bresult);
@@ -661,7 +659,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd("foo", 2, "b"); jedis.zadd("foo", 2, "b");
jedis.zadd("bar", 2, "a"); jedis.zadd("bar", 2, "a");
int result = jedis.zinterstore("dst", "foo", "bar"); long result = jedis.zinterstore("dst", "foo", "bar");
assertEquals(1, result); assertEquals(1, result);
@@ -675,7 +673,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
jedis.zadd(bfoo, 2, bb); jedis.zadd(bfoo, 2, bb);
jedis.zadd(bbar, 2, ba); jedis.zadd(bbar, 2, ba);
int bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bfoo, bbar); long bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bfoo, bbar);
assertEquals(1, bresult); assertEquals(1, bresult);
@@ -695,7 +693,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
ZParams params = new ZParams(); ZParams params = new ZParams();
params.weights(2, 2); params.weights(2, 2);
params.aggregate(ZParams.Aggregate.SUM); params.aggregate(ZParams.Aggregate.SUM);
int result = jedis.zinterstore("dst", params, "foo", "bar"); long result = jedis.zinterstore("dst", params, "foo", "bar");
assertEquals(1, result); assertEquals(1, result);
@@ -712,7 +710,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
ZParams bparams = new ZParams(); ZParams bparams = new ZParams();
bparams.weights(2, 2); bparams.weights(2, 2);
bparams.aggregate(ZParams.Aggregate.SUM); bparams.aggregate(ZParams.Aggregate.SUM);
int bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bparams, long bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bparams,
bfoo, bbar); bfoo, bbar);
assertEquals(1, bresult); assertEquals(1, bresult);

View File

@@ -271,7 +271,7 @@ public class SortingCommandsTest extends JedisCommandTestBase {
jedis.lpush("foo", "2"); jedis.lpush("foo", "2");
jedis.lpush("foo", "10"); jedis.lpush("foo", "10");
int result = jedis.sort("foo", "result"); long result = jedis.sort("foo", "result");
List<String> expected = new ArrayList<String>(); List<String> expected = new ArrayList<String>();
expected.add("1"); expected.add("1");
@@ -287,7 +287,7 @@ public class SortingCommandsTest extends JedisCommandTestBase {
jedis.lpush(bfoo, b10); jedis.lpush(bfoo, b10);
byte[] bkresult = new byte[] { 0X09, 0x0A, 0x0B, 0x0C }; byte[] bkresult = new byte[] { 0X09, 0x0A, 0x0B, 0x0C };
int bresult = jedis.sort(bfoo, bkresult); long bresult = jedis.sort(bfoo, bkresult);
List<byte[]> bexpected = new ArrayList<byte[]>(); List<byte[]> bexpected = new ArrayList<byte[]>();
bexpected.add(b1); bexpected.add(b1);

View File

@@ -57,7 +57,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void setnx() { public void setnx() {
int status = jedis.setnx("foo", "bar"); long status = jedis.setnx("foo", "bar");
assertEquals(1, status); assertEquals(1, status);
assertEquals("bar", jedis.get("foo")); assertEquals("bar", jedis.get("foo"));
@@ -70,7 +70,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
public void setex() { public void setex() {
String status = jedis.setex("foo", 20, "bar"); String status = jedis.setex("foo", 20, "bar");
assertEquals("OK", status); assertEquals("OK", status);
int ttl = jedis.ttl("foo"); long ttl = jedis.ttl("foo");
assertTrue(ttl > 0 && ttl <= 20); assertTrue(ttl > 0 && ttl <= 20);
} }
@@ -84,7 +84,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void msetnx() { public void msetnx() {
int status = jedis.msetnx("foo", "bar", "bar", "foo"); long status = jedis.msetnx("foo", "bar", "bar", "foo");
assertEquals(1, status); assertEquals(1, status);
assertEquals("bar", jedis.get("foo")); assertEquals("bar", jedis.get("foo"));
assertEquals("foo", jedis.get("bar")); assertEquals("foo", jedis.get("bar"));
@@ -103,7 +103,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void incr() { public void incr() {
int value = jedis.incr("foo"); long value = jedis.incr("foo");
assertEquals(1, value); assertEquals(1, value);
value = jedis.incr("foo"); value = jedis.incr("foo");
assertEquals(2, value); assertEquals(2, value);
@@ -117,7 +117,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void incrBy() { public void incrBy() {
int value = jedis.incrBy("foo", 2); long value = jedis.incrBy("foo", 2);
assertEquals(2, value); assertEquals(2, value);
value = jedis.incrBy("foo", 2); value = jedis.incrBy("foo", 2);
assertEquals(4, value); assertEquals(4, value);
@@ -131,7 +131,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void decr() { public void decr() {
int value = jedis.decr("foo"); long value = jedis.decr("foo");
assertEquals(-1, value); assertEquals(-1, value);
value = jedis.decr("foo"); value = jedis.decr("foo");
assertEquals(-2, value); assertEquals(-2, value);
@@ -145,7 +145,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void decrBy() { public void decrBy() {
int value = jedis.decrBy("foo", 2); long value = jedis.decrBy("foo", 2);
assertEquals(-2, value); assertEquals(-2, value);
value = jedis.decrBy("foo", 2); value = jedis.decrBy("foo", 2);
assertEquals(-4, value); assertEquals(-4, value);
@@ -153,7 +153,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase {
@Test @Test
public void append() { public void append() {
int value = jedis.append("foo", "bar"); long value = jedis.append("foo", "bar");
assertEquals(3, value); assertEquals(3, value);
assertEquals("bar", jedis.get("foo")); assertEquals("bar", jedis.get("foo"));
value = jedis.append("foo", "bar"); value = jedis.append("foo", "bar");

View File

@@ -26,7 +26,8 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
Jedis nj; Jedis nj;
@Before @Override
@Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
@@ -52,9 +53,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
List<Object> response = trans.exec(); List<Object> response = trans.exec();
List<Object> expected = new ArrayList<Object>(); List<Object> expected = new ArrayList<Object>();
expected.add(1); expected.add(1L);
expected.add(1); expected.add(1L);
expected.add(2); expected.add(2L);
assertEquals(expected, response); assertEquals(expected, response);
// Binary // Binary
@@ -72,9 +73,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
response = trans.exec(); response = trans.exec();
expected = new ArrayList<Object>(); expected = new ArrayList<Object>();
expected.add(1); expected.add(1L);
expected.add(1); expected.add(1L);
expected.add(2); expected.add(2L);
assertEquals(expected, response); assertEquals(expected, response);
} }
@@ -82,7 +83,8 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
@Test @Test
public void multiBlock() { public void multiBlock() {
List<Object> response = jedis.multi(new TransactionBlock() { List<Object> response = jedis.multi(new TransactionBlock() {
public void execute() { @Override
public void execute() {
String status = sadd("foo", "a"); String status = sadd("foo", "a");
assertEquals(Keyword.QUEUED.name(), status); assertEquals(Keyword.QUEUED.name(), status);
@@ -95,14 +97,15 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
}); });
List<Object> expected = new ArrayList<Object>(); List<Object> expected = new ArrayList<Object>();
expected.add(1); expected.add(1L);
expected.add(1); expected.add(1L);
expected.add(2); expected.add(2L);
assertEquals(expected, response); assertEquals(expected, response);
// Binary // Binary
response = jedis.multi(new TransactionBlock() { response = jedis.multi(new TransactionBlock() {
public void execute() { @Override
public void execute() {
String status = sadd(bfoo, ba); String status = sadd(bfoo, ba);
assertEquals(Keyword.QUEUED.name(), status); assertEquals(Keyword.QUEUED.name(), status);
@@ -115,9 +118,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
}); });
expected = new ArrayList<Object>(); expected = new ArrayList<Object>();
expected.add(1); expected.add(1L);
expected.add(1); expected.add(1L);
expected.add(2); expected.add(2L);
assertEquals(expected, response); assertEquals(expected, response);
} }