Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
33 changes: 29 additions & 4 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -1441,11 +1461,16 @@ public void xadd(final byte[] key, final byte[] id, final Map<byte[], byte[]> 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));
}
Expand Down
47 changes: 33 additions & 14 deletions src/main/java/redis/clients/jedis/BinaryJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public Long dbSize() {
* 2.1.3, Redis &gt;= 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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -4337,7 +4337,7 @@ public Long xlen(byte[] key) {
}

@Override
public List<byte[]> xrange(byte[] key, byte[] start, byte[] end, long count) {
public List<byte[]> xrange(byte[] key, byte[] start, byte[] end, int count) {
checkIsInMultiOrPipeline();
client.xrange(key, start, end, count);
return client.getBinaryMultiBulkReply();
Expand Down Expand Up @@ -4400,42 +4400,61 @@ public Long xtrim(byte[] key, long maxLen, boolean approximateLength) {
}

@Override
public List<byte[]> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername) {
public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername) {
checkIsInMultiOrPipeline();
client.xpending(key, groupname, start, end, count, consumername);
return client.getBinaryMultiBulkReply(); }
return client.getObjectMultiBulkReply();
}

@Override
public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[][] ids){
public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[]... ids) {
checkIsInMultiOrPipeline();
client.xclaim(key, groupname, consumername, minIdleTime, newIdleTime, retries, force, ids);
return client.getBinaryMultiBulkReply();
return client.getBinaryMultiBulkReply();
}

@Override
public StreamInfo xinfoStream(byte[] key) {
checkIsInMultiOrPipeline();
client.xinfoStream(key);

return BuilderFactory.STREAM_INFO.build(client.getOne());
}

@Override
public Object xinfoStreamBinary(byte[] key) {
checkIsInMultiOrPipeline();
client.xinfoStream(key);
return client.getOne();
}

@Override
public List<StreamGroupInfo> xinfoGroup (byte[] key) {
public List<StreamGroupInfo> xinfoGroup(byte[] key) {
checkIsInMultiOrPipeline();
client.xinfoGroup(key);

return BuilderFactory.STREAM_GROUP_INFO_LIST.build(client.getBinaryMultiBulkReply());
}

@Override
public List<StreamConsumersInfo> xinfoConsumers (byte[] key, byte[] group) {
public List<Object> xinfoGroupBinary(byte[] key) {
checkIsInMultiOrPipeline();
client.xinfoConsumers(key,group);
client.xinfoGroup(key);
return client.getObjectMultiBulkReply();
}

@Override
public List<StreamConsumersInfo> xinfoConsumers(byte[] key, byte[] group) {
checkIsInMultiOrPipeline();
client.xinfoConsumers(key, group);
return BuilderFactory.STREAM_CONSUMERS_INFO_LIST.build(client.getBinaryMultiBulkReply());
}

@Override
public List<Object> xinfoConsumersBinary(byte[] key, byte[] group) {
checkIsInMultiOrPipeline();
client.xinfoConsumers(key, group);
return client.getObjectMultiBulkReply();
}

public Object sendCommand(ProtocolCommand cmd, byte[]... args) {
checkIsInMultiOrPipeline();
client.sendCommand(cmd, args);
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/redis/clients/jedis/BinaryJedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public byte[] execute(Jedis connection) {
}

@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) {
return new JedisClusterCommand<String>(connectionHandler, maxAttempts) {
@Override
public String execute(Jedis connection) {
Expand Down Expand Up @@ -383,7 +383,7 @@ public String execute(Jedis connection) {
}

@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) {
return new JedisClusterCommand<String>(connectionHandler, maxAttempts) {
@Override
public String execute(Jedis connection) {
Expand Down Expand Up @@ -2266,6 +2266,16 @@ public List<byte[]> execute(Jedis connection) {
}.runBinary(key);
}

@Override
public List<byte[]> xrange(final byte[] key, final byte[] start, final byte[] end, final int count) {
return new JedisClusterCommand<List<byte[]>>(connectionHandler, maxAttempts) {
@Override
public List<byte[]> execute(Jedis connection) {
return connection.xrange(key, start, end, count);
}
}.runBinary(key);
}

@Override
public List<byte[]> xrevrange(final byte[] key, final byte[] end, final byte[] start, final int count) {
return new JedisClusterCommand<List<byte[]>>(connectionHandler, maxAttempts) {
Expand Down Expand Up @@ -2373,11 +2383,11 @@ public Long execute(Jedis connection) {
}

@Override
public List<byte[]> xpending(final byte[] key, final byte[] groupname, final byte[] start, final byte[] end,
public List<Object> xpending(final byte[] key, final byte[] groupname, final byte[] start, final byte[] end,
final int count, final byte[] consumername) {
return new JedisClusterCommand<List<byte[]>>(connectionHandler, maxAttempts) {
return new JedisClusterCommand<List<Object>>(connectionHandler, maxAttempts) {
@Override
public List<byte[]> execute(Jedis connection) {
public List<Object> execute(Jedis connection) {
return connection.xpending(key, groupname, start, end, count, consumername);
}
}.runBinary(key);
Expand Down
35 changes: 27 additions & 8 deletions src/main/java/redis/clients/jedis/BinaryShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,19 @@ 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) {
Jedis j = getShard(key);
return j.restore(key, ttl, serializedValue);
}

@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) {
Jedis j = getShard(key);
return j.restoreReplace(key, ttl, serializedValue);
}

@Override
public Long expire(final byte[] key, final int seconds) {
public Long expire(final byte[] key, final long seconds) {
Jedis j = getShard(key);
return j.expire(key, seconds);
}
Expand Down Expand Up @@ -176,7 +176,7 @@ public Long setnx(final byte[] key, final byte[] value) {
}

@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) {
Jedis j = getShard(key);
return j.setex(key, seconds, value);
}
Expand Down Expand Up @@ -1070,7 +1070,7 @@ public Long xlen(byte[] key) {
}

@Override
public List<byte[]> xrange(byte[] key, byte[] start, byte[] end, long count) {
public List<byte[]> xrange(byte[] key, byte[] start, byte[] end, int count) {
Jedis j = getShard(key);
return j.xrange(key, start, end, count);
}
Expand Down Expand Up @@ -1124,14 +1124,15 @@ public Long xtrim(byte[] key, long maxLen, boolean approximateLength) {
}

@Override
public List<byte[]> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername) {
public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count,
byte[] consumername) {
Jedis j = getShard(key);
return j.xpending(key, groupname, start, end, count, consumername);
}

@Override
public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime,
int retries, boolean force, byte[][] ids) {
public List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, byte[]... ids) {
Jedis j = getShard(key);
return j.xclaim(key, groupname, consumername, minIdleTime, newIdleTime, retries, force, ids);
}
Expand All @@ -1142,18 +1143,36 @@ public StreamInfo xinfoStream(byte[] key) {
return j.xinfoStream(key);
}

@Override
public Object xinfoStreamBinary(byte[] key) {
Jedis j = getShard(key);
return j.xinfoStreamBinary(key);
}

@Override
public List<StreamGroupInfo> xinfoGroup(byte[] key) {
Jedis j = getShard(key);
return j.xinfoGroup(key);
}

@Override
public List<Object> xinfoGroupBinary(byte[] key) {
Jedis j = getShard(key);
return j.xinfoGroupBinary(key);
}

@Override
public List<StreamConsumersInfo> xinfoConsumers(byte[] key, byte[] group) {
Jedis j = getShard(key);
return j.xinfoConsumers(key, group);
}

@Override
public List<Object> xinfoConsumersBinary(byte[] key, byte[] group) {
Jedis j = getShard(key);
return j.xinfoConsumersBinary(key, group);
}

public Object sendCommand(ProtocolCommand cmd, byte[]... args) {
// default since no sample key provided in JedisCommands interface
byte[] sampleKey = args.length > 0 ? args[0] : cmd.getRaw();
Expand Down
Loading