From c3c33776dc8e7aaa95df74833d1f83939bb52fcc Mon Sep 17 00:00:00 2001
From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com>
Date: Tue, 2 Mar 2021 12:34:48 +0600
Subject: [PATCH 1/4] Fix parameter types and return types
---
pom.xml | 4 +-
.../redis/clients/jedis/BinaryClient.java | 33 ++++++++--
.../java/redis/clients/jedis/BinaryJedis.java | 47 +++++++++-----
.../clients/jedis/BinaryJedisCluster.java | 20 ++++--
.../clients/jedis/BinaryShardedJedis.java | 35 ++++++++---
.../redis/clients/jedis/BuilderFactory.java | 44 ++++++++-----
src/main/java/redis/clients/jedis/Client.java | 8 +--
src/main/java/redis/clients/jedis/Jedis.java | 8 +--
.../redis/clients/jedis/JedisCluster.java | 6 +-
.../redis/clients/jedis/PipelineBase.java | 21 +++----
.../redis/clients/jedis/ShardedJedis.java | 8 +--
.../commands/BinaryJedisClusterCommands.java | 21 +++++--
.../jedis/commands/BinaryJedisCommands.java | 62 ++++++++++++++-----
.../jedis/commands/BinaryRedisPipeline.java | 32 ++++++++--
.../clients/jedis/commands/Commands.java | 28 +++++++--
.../jedis/commands/JedisClusterCommands.java | 27 +++++---
.../clients/jedis/commands/JedisCommands.java | 28 +++++++--
.../clients/jedis/commands/RedisPipeline.java | 28 +++++++--
18 files changed, 340 insertions(+), 120 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1f0d73253d..b063505409 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,8 +129,8 @@
maven-compiler-plugin
3.8.1
- 1.7
- 1.7
+ 1.8
+ 1.8
diff --git a/src/main/java/redis/clients/jedis/BinaryClient.java b/src/main/java/redis/clients/jedis/BinaryClient.java
index 7c2b99c82e..4f57575793 100644
--- a/src/main/java/redis/clients/jedis/BinaryClient.java
+++ b/src/main/java/redis/clients/jedis/BinaryClient.java
@@ -193,10 +193,15 @@ public void dbSize() {
sendCommand(DBSIZE);
}
+ @Deprecated
public void expire(final byte[] key, final int seconds) {
sendCommand(EXPIRE, key, toByteArray(seconds));
}
+ public void expire(final byte[] key, final long seconds) {
+ sendCommand(EXPIRE, key, toByteArray(seconds));
+ }
+
public void expireAt(final byte[] key, final long unixTime) {
sendCommand(EXPIREAT, key, toByteArray(unixTime));
}
@@ -237,10 +242,15 @@ public void setnx(final byte[] key, final byte[] value) {
sendCommand(SETNX, key, value);
}
+ @Deprecated
public void setex(final byte[] key, final int seconds, final byte[] value) {
sendCommand(SETEX, key, toByteArray(seconds), value);
}
+ public void setex(final byte[] key, final long seconds, final byte[] value) {
+ sendCommand(SETEX, key, toByteArray(seconds), value);
+ }
+
public void mset(final byte[]... keysvalues) {
sendCommand(MSET, keysvalues);
}
@@ -1068,14 +1078,24 @@ public void dump(final byte[] key) {
sendCommand(DUMP, key);
}
+ @Deprecated
public void restore(final byte[] key, final int ttl, final byte[] serializedValue) {
sendCommand(RESTORE, key, toByteArray(ttl), serializedValue);
}
+ public void restore(final byte[] key, final long ttl, final byte[] serializedValue) {
+ sendCommand(RESTORE, key, toByteArray(ttl), serializedValue);
+ }
+
+ @Deprecated
public void restoreReplace(final byte[] key, final int ttl, final byte[] serializedValue) {
sendCommand(RESTORE, key, toByteArray(ttl), serializedValue, Keyword.REPLACE.getRaw());
}
+ public void restoreReplace(final byte[] key, final long ttl, final byte[] serializedValue) {
+ sendCommand(RESTORE, key, toByteArray(ttl), serializedValue, Keyword.REPLACE.getRaw());
+ }
+
public void pexpire(final byte[] key, final long milliseconds) {
sendCommand(PEXPIRE, key, toByteArray(milliseconds));
}
@@ -1441,11 +1461,16 @@ public void xadd(final byte[] key, final byte[] id, final Map ha
public void xlen(final byte[] key) {
sendCommand(XLEN, key);
}
-
- public void xrange(final byte[] key, final byte[] start, final byte[] end, final long count) {
- sendCommand(XRANGE, key, start, end, Keyword.COUNT.getRaw(), toByteArray(count));
+
+ @Deprecated
+ public void xrange(final byte[] key, final byte[] start, final byte[] end, final long count) {
+ sendCommand(XRANGE, key, start, end, Keyword.COUNT.getRaw(), toByteArray(count));
}
-
+
+ public void xrange(final byte[] key, final byte[] start, final byte[] end, final int count) {
+ sendCommand(XRANGE, key, start, end, Keyword.COUNT.getRaw(), toByteArray(count));
+ }
+
public void xrevrange(final byte[] key, final byte[] end, final byte[] start, final int count) {
sendCommand(XREVRANGE, key, end, start, Keyword.COUNT.getRaw(), toByteArray(count));
}
diff --git a/src/main/java/redis/clients/jedis/BinaryJedis.java b/src/main/java/redis/clients/jedis/BinaryJedis.java
index 1e5427ccb0..28197129cb 100644
--- a/src/main/java/redis/clients/jedis/BinaryJedis.java
+++ b/src/main/java/redis/clients/jedis/BinaryJedis.java
@@ -539,7 +539,7 @@ public Long dbSize() {
* 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
*/
@Override
- public Long expire(final byte[] key, final int seconds) {
+ public Long expire(final byte[] key, final long seconds) {
checkIsInMultiOrPipeline();
client.expire(key, seconds);
return client.getIntegerReply();
@@ -724,7 +724,7 @@ public Long setnx(final byte[] key, final byte[] value) {
* @return Status code reply
*/
@Override
- public String setex(final byte[] key, final int seconds, final byte[] value) {
+ public String setex(final byte[] key, final long seconds, final byte[] value) {
checkIsInMultiOrPipeline();
client.setex(key, seconds, value);
return client.getStatusCodeReply();
@@ -3680,14 +3680,14 @@ public byte[] dump(final byte[] key) {
}
@Override
- public String restore(final byte[] key, final int ttl, final byte[] serializedValue) {
+ public String restore(final byte[] key, final long ttl, final byte[] serializedValue) {
checkIsInMultiOrPipeline();
client.restore(key, ttl, serializedValue);
return client.getStatusCodeReply();
}
@Override
- public String restoreReplace(final byte[] key, final int ttl, final byte[] serializedValue) {
+ public String restoreReplace(final byte[] key, final long ttl, final byte[] serializedValue) {
checkIsInMultiOrPipeline();
client.restoreReplace(key, ttl, serializedValue);
return client.getStatusCodeReply();
@@ -4337,7 +4337,7 @@ public Long xlen(byte[] key) {
}
@Override
- public List xrange(byte[] key, byte[] start, byte[] end, long count) {
+ public List xrange(byte[] key, byte[] start, byte[] end, int count) {
checkIsInMultiOrPipeline();
client.xrange(key, start, end, count);
return client.getBinaryMultiBulkReply();
@@ -4400,42 +4400,61 @@ public Long xtrim(byte[] key, long maxLen, boolean approximateLength) {
}
@Override
- public List xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername) {
+ public List