add rightPopLeftPush to list operations
This commit is contained in:
@@ -49,7 +49,7 @@ public interface ListOperations<K, V> {
|
||||
|
||||
V rightPop(K key, long timeout, TimeUnit unit);
|
||||
|
||||
void rightPopAndLeftPush(K sourceKey, K destinationKey);
|
||||
V rightPopAndLeftPush(K sourceKey, K destinationKey);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
}
|
||||
|
||||
@@ -890,6 +890,18 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V rightPopAndLeftPush(K sourceKey, K destinationKey) {
|
||||
final byte[] rawDestKey = rawKey(destinationKey);
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(sourceKey) {
|
||||
@Override
|
||||
protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) {
|
||||
return connection.rPopLPush(rawSourceKey, rawDestKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(K key, final long index, V value) {
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
Reference in New Issue
Block a user