Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand All @@ -217,11 +217,11 @@
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goals>
<goal>manifest</goal>
</goals>
</goals>
</execution>
</executions>
</executions>
</plugin>
</plugins>
</build>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,10 @@ public void xtrim(byte[] key, long maxLen, boolean approximateLength) {
}
}

public void xtrim(byte[] key, XTrimParams params) {
sendCommand(XTRIM, params.getByteParams(key));
}

/**
* @deprecated This method will be removed due to bug regarding {@code block} param. Use
* {@link #xreadGroup(byte..., byte..., redis.clients.jedis.params.XReadGroupParams, java.util.Map.Entry...)}.
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/BinaryJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4729,6 +4729,13 @@ public Long xtrim(byte[] key, long maxLen, boolean approximateLength) {
return client.getIntegerReply();
}

@Override
public Long xtrim(byte[] key, XTrimParams params) {
checkIsInMultiOrPipeline();
client.xtrim(key, params);
return client.getIntegerReply();
}

@Override
public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count,
byte[] consumername) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/redis/clients/jedis/BinaryJedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,16 @@ public Long execute(Jedis connection) {
}.runBinary(key);
}

@Override
public Long xtrim(final byte[] key, final XTrimParams params) {
return new JedisClusterCommand<Long>(connectionHandler, maxAttempts) {
@Override
public Long execute(Jedis connection) {
return connection.xtrim(key, params);
}
}.runBinary(key);
}

@Override
public List<Object> xpending(final byte[] key, final byte[] groupname, final byte[] start,
final byte[] end, final int count, final byte[] consumername) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/BinaryShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -1205,6 +1206,12 @@ public Long xtrim(byte[] key, long maxLen, boolean approximateLength) {
return j.xtrim(key, maxLen, approximateLength);
}

@Override
public Long xtrim(byte[] key, XTrimParams params) {
Jedis j = getShard(key);
return j.xtrim(key, params);
}

@Override
public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count,
byte[] consumername) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/redis/clients/jedis/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,11 @@ public void xtrim(String key, long maxLen, boolean approximateLength) {
xtrim(SafeEncoder.encode(key), maxLen, approximateLength);
}

@Override
public void xtrim(String key, XTrimParams params) {
xtrim(SafeEncoder.encode(key), params);
}

@Override
public void xreadGroup(String groupname, String consumer, int count, long block, boolean noAck,
Entry<String, StreamEntryID>... streams) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4257,6 +4257,13 @@ public long xtrim(final String key, final long maxLen, final boolean approximate
return client.getIntegerReply();
}

@Override
public long xtrim(final String key, final XTrimParams params) {
checkIsInMultiOrPipeline();
client.xtrim(key, params);
return client.getIntegerReply();
}

/**
* {@inheritDoc}
*/
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/redis/clients/jedis/JedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,16 @@ public Long execute(Jedis connection) {
}.run(key);
}

@Override
public Long xtrim(final String key, final XTrimParams params) {
return new JedisClusterCommand<Long>(connectionHandler, maxAttempts) {
@Override
public Long execute(Jedis connection) {
return connection.xtrim(key, params);
}
}.run(key);
}

@Override
public List<StreamEntry> xclaim(final String key, final String group, final String consumername,
final long minIdleTime, final long newIdleTime, final int retries, final boolean force,
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/redis/clients/jedis/PipelineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -2304,6 +2305,18 @@ public Response<Long> xtrim(byte[] key, long maxLen, boolean approximateLength)
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> xtrim(byte[] key, XTrimParams params) {
getClient(key).xtrim(key, params);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<Long> xtrim(String key, XTrimParams params) {
getClient(key).xtrim(key, params);
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<List<StreamEntry>> xclaim(String key, String group, String consumername,
long minIdleTime, long newIdleTime, int retries, boolean force, StreamEntryID... ids) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/redis/clients/jedis/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public final class Protocol {
public static final byte[] BYTES_TRUE = toByteArray(1);
public static final byte[] BYTES_FALSE = toByteArray(0);
public static final byte[] BYTES_TILDE = SafeEncoder.encode("~");
public static final byte[] BYTES_EQUAL = SafeEncoder.encode("=");

public static final byte[] POSITIVE_INFINITY_BYTES = "+inf".getBytes();
public static final byte[] NEGATIVE_INFINITY_BYTES = "-inf".getBytes();
Expand Down Expand Up @@ -283,7 +284,7 @@ public static enum Keyword implements Rawable {
GETNAME, SETNAME, LIST, MATCH, COUNT, PING, PONG, UNLOAD, REPLACE, KEYS, PAUSE, DOCTOR, BLOCK,
NOACK, STREAMS, KEY, CREATE, MKSTREAM, SETID, DESTROY, DELCONSUMER, MAXLEN, GROUP, ID, IDLE,
TIME, RETRYCOUNT, FORCE, USAGE, SAMPLES, STREAM, GROUPS, CONSUMERS, HELP, FREQ, SETUSER,
GETUSER, DELUSER, WHOAMI, CAT, GENPASS, USERS, LOG, INCR, SAVE, JUSTID, WITHVALUES, UNBLOCK;
GETUSER, DELUSER, WHOAMI, CAT, GENPASS, USERS, LOG, INCR, SAVE, JUSTID, WITHVALUES, UNBLOCK, MINID;

/**
* @deprecated This will be private in future. Use {@link #getRaw()}.
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/ShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -1189,6 +1190,12 @@ public long xtrim(String key, long maxLen, boolean approximateLength) {
return j.xtrim(key, maxLen, approximateLength);
}

@Override
public long xtrim(String key, XTrimParams params) {
Jedis j = getShard(key);
return j.xtrim(key, params);
}

@Override
public List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start) {
Jedis j = getShard(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -415,6 +416,8 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, dou

Long xtrim(byte[] key, long maxLen, boolean approximateLength);

Long xtrim(byte[] key, XTrimParams params);

Object xpending(final byte[] key, final byte[] groupname);

List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -445,6 +446,8 @@ default List<byte[]> xrange(byte[] key, byte[] start, byte[] end, long count) {

Long xtrim(byte[] key, long maxLen, boolean approximateLength);

Long xtrim(byte[] key, XTrimParams params);

Object xpending(byte[] key, byte[] groupname);

List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -417,6 +418,8 @@ Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(byte[] key, byte[] m

Response<Long> xtrim(byte[] key, long maxLen, boolean approximateLength);

Response<Long> xtrim(byte[] key, XTrimParams params);

Response<List<byte[]>> xclaim(byte[] key, byte[] group, byte[] consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, byte[]... ids);

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/redis/clients/jedis/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import redis.clients.jedis.params.ClientKillParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -494,6 +495,8 @@ default void restoreReplace(String key, int ttl, byte[] serializedValue) {

void xtrim(String key, long maxLen, boolean approximateLength);

void xtrim(String key, XTrimParams params);

/**
* @deprecated This method will be removed due to bug regarding {@code block} param. Use
* {@link #xreadGroup(java.lang.String, java.lang.String, redis.clients.jedis.params.XReadGroupParams, java.util.Map)}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -581,6 +582,14 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, dou
*/
Long xtrim( String key, long maxLen, boolean approximateLength);

/**
* XTRIM key MAXLEN|MINID [=|~] threshold [LIMIT count]
* @param key
* @param params
* @return
*/
Long xtrim(String key, XTrimParams params);

/**
* XCLAIM <key> <group> <consumer> <min-idle-time> <ID-1> <ID-2>
* [IDLE <milliseconds>] [TIME <mstime>] [RETRYCOUNT <count>]
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/redis/clients/jedis/commands/JedisCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -585,6 +586,14 @@ List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID st
*/
long xtrim( String key, long maxLen, boolean approximate);

/**
* XTRIM key MAXLEN|MINID [=|~] threshold [LIMIT count]
* @param key
* @param params
* @return
*/
long xtrim(String key, XTrimParams params);

/**
* XCLAIM <key> <group> <consumer> <min-idle-time> <ID-1> <ID-2>
* [IDLE <milliseconds>] [TIME <mstime>] [RETRYCOUNT <count>]
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/redis/clients/jedis/commands/RedisPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.params.LPosParams;
Expand Down Expand Up @@ -409,6 +410,8 @@ Response<List<StreamPendingEntry>> xpending(String key, String groupname,

Response<Long> xtrim( String key, long maxLen, boolean approximateLength);

Response<Long> xtrim(String key, XTrimParams params);

Response<List<StreamEntry>> xclaim( String key, String group, String consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, StreamEntryID... ids);

Expand Down
Loading