diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java index f2a4f5f82..52de7a979 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java @@ -33,6 +33,10 @@ public interface RedisListCommands { Long lPush(byte[] key, byte[] value); + Long rPushX(byte[] key, byte[] value); + + Long lPushX(byte[] key, byte[] value); + Long lLen(byte[] key); List lRange(byte[] key, long start, long end); @@ -56,4 +60,6 @@ public interface RedisListCommands { List bRPop(int timeout, byte[]... keys); byte[] rPopLPush(byte[] srcKey, byte[] dstKey); + + byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java index 3826c1699..935217db3 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java @@ -785,6 +785,42 @@ public class JedisConnection implements RedisConnection { } } + @Override + public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) { + try { + if (isQueueing()) { + throw new UnsupportedOperationException(); + } + return jedis.brpoplpush(srcKey, dstKey, timeout).getBytes(); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } + } + + @Override + public Long lPushX(byte[] key, byte[] value) { + try { + if (isQueueing()) { + throw new UnsupportedOperationException(); + } + return jedis.lpushx(key, value); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } + } + + @Override + public Long rPushX(byte[] key, byte[] value) { + try { + if (isQueueing()) { + throw new UnsupportedOperationException(); + } + return jedis.rpushx(key, value); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } + } + // // Set commands diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java index befd7490a..fa3da3b31 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java @@ -516,6 +516,21 @@ public class JredisConnection implements RedisConnection { throw new UnsupportedOperationException(); } + @Override + public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) { + throw new UnsupportedOperationException(); + } + + @Override + public Long lPushX(byte[] key, byte[] value) { + throw new UnsupportedOperationException(); + } + + @Override + public Long rPushX(byte[] key, byte[] value) { + throw new UnsupportedOperationException(); + } + // // Set commands