hincr, incr and decr long support

This commit is contained in:
Jonathan Leibiusky
2010-12-10 17:21:22 -03:00
parent ff8ac4c9db
commit afd34c8af6
11 changed files with 33 additions and 33 deletions

View File

@@ -140,7 +140,7 @@ public class BinaryClient extends Connection {
sendCommand(MSETNX, keysvalues); sendCommand(MSETNX, keysvalues);
} }
public void decrBy(final byte[] key, final int integer) { public void decrBy(final byte[] key, final long integer) {
sendCommand(DECRBY, key, toByteArray(integer)); sendCommand(DECRBY, key, toByteArray(integer));
} }
@@ -148,7 +148,7 @@ public class BinaryClient extends Connection {
sendCommand(DECR, key); sendCommand(DECR, key);
} }
public void incrBy(final byte[] key, final int integer) { public void incrBy(final byte[] key, final long integer) {
sendCommand(INCRBY, key, toByteArray(integer)); sendCommand(INCRBY, key, toByteArray(integer));
} }
@@ -194,7 +194,7 @@ public class BinaryClient extends Connection {
sendCommand(HMGET, params); sendCommand(HMGET, params);
} }
public void hincrBy(final byte[] key, final byte[] field, final int value) { public void hincrBy(final byte[] key, final byte[] field, final long value) {
sendCommand(HINCRBY, key, field, toByteArray(value)); sendCommand(HINCRBY, key, field, toByteArray(value));
} }

View File

@@ -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 Long decrBy(final byte[] key, final int integer) { public Long decrBy(final byte[] key, final long integer) {
checkIsInMulti(); checkIsInMulti();
client.decrBy(key, integer); client.decrBy(key, integer);
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 Long incrBy(final byte[] key, final int integer) { public Long incrBy(final byte[] key, final long integer) {
checkIsInMulti(); checkIsInMulti();
client.incrBy(key, integer); client.incrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -768,7 +768,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 Long hincrBy(final byte[] key, final byte[] field, final int value) { public Long hincrBy(final byte[] key, final byte[] field, final long value) {
checkIsInMulti(); checkIsInMulti();
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();

View File

@@ -31,11 +31,11 @@ public interface BinaryJedisCommands {
String setex(byte[] key, int seconds, byte[] value); String setex(byte[] key, int seconds, byte[] value);
Long decrBy(byte[] key, int integer); Long decrBy(byte[] key, long integer);
Long decr(byte[] key); Long decr(byte[] key);
Long incrBy(byte[] key, int integer); Long incrBy(byte[] key, long integer);
Long incr(byte[] key); Long incr(byte[] key);
@@ -53,7 +53,7 @@ public interface BinaryJedisCommands {
List<byte[]> hmget(byte[] key, byte[]... fields); List<byte[]> hmget(byte[] key, byte[]... fields);
Long hincrBy(byte[] key, byte[] field, int value); Long hincrBy(byte[] key, byte[] field, long value);
Boolean hexists(byte[] key, byte[] field); Boolean hexists(byte[] key, byte[] field);

View File

@@ -90,7 +90,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.setex(key, seconds, value); return j.setex(key, seconds, value);
} }
public Long decrBy(byte[] key, int integer) { public Long decrBy(byte[] key, long integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decrBy(key, integer); return j.decrBy(key, integer);
} }
@@ -100,7 +100,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.decr(key); return j.decr(key);
} }
public Long incrBy(byte[] key, int integer) { public Long incrBy(byte[] key, long integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incrBy(key, integer); return j.incrBy(key, integer);
} }
@@ -145,7 +145,7 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
return j.hmget(key, fields); return j.hmget(key, fields);
} }
public Long hincrBy(byte[] key, byte[] field, int value) { public Long hincrBy(byte[] key, byte[] field, long value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hincrBy(key, field, value); return j.hincrBy(key, field, value);
} }

View File

@@ -103,7 +103,7 @@ public class Client extends BinaryClient implements Commands {
msetnx(bkeysvalues); msetnx(bkeysvalues);
} }
public void decrBy(final String key, final int integer) { public void decrBy(final String key, final long integer) {
decrBy(SafeEncoder.encode(key), integer); decrBy(SafeEncoder.encode(key), integer);
} }
@@ -111,7 +111,7 @@ public class Client extends BinaryClient implements Commands {
decr(SafeEncoder.encode(key)); decr(SafeEncoder.encode(key));
} }
public void incrBy(final String key, final int integer) { public void incrBy(final String key, final long integer) {
incrBy(SafeEncoder.encode(key), integer); incrBy(SafeEncoder.encode(key), integer);
} }
@@ -159,7 +159,7 @@ public class Client extends BinaryClient implements Commands {
hmget(SafeEncoder.encode(key), bfields); hmget(SafeEncoder.encode(key), bfields);
} }
public void hincrBy(final String key, final String field, final int value) { public void hincrBy(final String key, final String field, final long value) {
hincrBy(SafeEncoder.encode(key), SafeEncoder.encode(field), value); hincrBy(SafeEncoder.encode(key), SafeEncoder.encode(field), value);
} }

View File

@@ -42,11 +42,11 @@ public interface Commands {
public void msetnx(final String... keysvalues); public void msetnx(final String... keysvalues);
public void decrBy(final String key, final int integer); public void decrBy(final String key, final long integer);
public void decr(final String key); public void decr(final String key);
public void incrBy(final String key, final int integer); public void incrBy(final String key, final long integer);
public void incr(final String key); public void incr(final String key);
@@ -64,7 +64,7 @@ public interface Commands {
public void hmget(final String key, final String... fields); public void hmget(final String key, final String... fields);
public void hincrBy(final String key, final String field, final int value); public void hincrBy(final String key, final String field, final long value);
public void hexists(final String key, final String field); public void hexists(final String key, final String field);

View File

@@ -518,7 +518,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 Long decrBy(final String key, final int integer) { public Long decrBy(final String key, final long integer) {
runChecks(); runChecks();
client.decrBy(key, integer); client.decrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -574,7 +574,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 Long incrBy(final String key, final int integer) { public Long incrBy(final String key, final long integer) {
runChecks(); runChecks();
client.incrBy(key, integer); client.incrBy(key, integer);
return client.getIntegerReply(); return client.getIntegerReply();
@@ -766,7 +766,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 Long hincrBy(final String key, final String field, final int value) { public Long hincrBy(final String key, final String field, final long value) {
runChecks(); runChecks();
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
return client.getIntegerReply(); return client.getIntegerReply();

View File

@@ -29,11 +29,11 @@ public interface JedisCommands {
String setex(String key, int seconds, String value); String setex(String key, int seconds, String value);
Long decrBy(String key, int integer); Long decrBy(String key, long integer);
Long decr(String key); Long decr(String key);
Long incrBy(String key, int integer); Long incrBy(String key, long integer);
Long incr(String key); Long incr(String key);
@@ -51,7 +51,7 @@ public interface JedisCommands {
List<String> hmget(String key, String... fields); List<String> hmget(String key, String... fields);
Long hincrBy(String key, String field, int value); Long hincrBy(String key, String field, long value);
Boolean hexists(String key, String field); Boolean hexists(String key, String field);

View File

@@ -28,7 +28,7 @@ public class Pipeline implements Commands {
client.decr(key); client.decr(key);
} }
public void decrBy(String key, int integer) { public void decrBy(String key, long integer) {
client.decrBy(key, integer); client.decrBy(key, integer);
} }
@@ -76,7 +76,7 @@ public class Pipeline implements Commands {
client.hgetAll(key); client.hgetAll(key);
} }
public void hincrBy(String key, String field, int value) { public void hincrBy(String key, String field, long value) {
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
} }
@@ -112,7 +112,7 @@ public class Pipeline implements Commands {
client.incr(key); client.incr(key);
} }
public void incrBy(String key, int integer) { public void incrBy(String key, long integer) {
client.incrBy(key, integer); client.incrBy(key, integer);
} }

View File

@@ -27,7 +27,7 @@ public abstract class PipelineBlock implements Commands {
client.decr(key); client.decr(key);
} }
public void decrBy(String key, int integer) { public void decrBy(String key, long integer) {
client.decrBy(key, integer); client.decrBy(key, integer);
} }
@@ -75,7 +75,7 @@ public abstract class PipelineBlock implements Commands {
client.hgetAll(key); client.hgetAll(key);
} }
public void hincrBy(String key, String field, int value) { public void hincrBy(String key, String field, long value) {
client.hincrBy(key, field, value); client.hincrBy(key, field, value);
} }
@@ -111,7 +111,7 @@ public abstract class PipelineBlock implements Commands {
client.incr(key); client.incr(key);
} }
public void incrBy(String key, int integer) { public void incrBy(String key, long integer) {
client.incrBy(key, integer); client.incrBy(key, integer);
} }

View File

@@ -86,7 +86,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.setex(key, seconds, value); return j.setex(key, seconds, value);
} }
public Long decrBy(String key, int integer) { public Long decrBy(String key, long integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.decrBy(key, integer); return j.decrBy(key, integer);
} }
@@ -96,7 +96,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.decr(key); return j.decr(key);
} }
public Long incrBy(String key, int integer) { public Long incrBy(String key, long integer) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.incrBy(key, integer); return j.incrBy(key, integer);
} }
@@ -141,7 +141,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
return j.hmget(key, fields); return j.hmget(key, fields);
} }
public Long hincrBy(String key, String field, int value) { public Long hincrBy(String key, String field, long value) {
Jedis j = getShard(key); Jedis j = getShard(key);
return j.hincrBy(key, field, value); return j.hincrBy(key, field, value);
} }