Example usage for org.springframework.data.redis.connection RedisConnection rPopLPush

List of usage examples for org.springframework.data.redis.connection RedisConnection rPopLPush

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection rPopLPush.

Prototype

@Nullable
byte[] rPopLPush(byte[] srcKey, byte[] dstKey);

Source Link

Document

Remove the last element from list at srcKey , append it to dstKey and return its value.

Usage

From source file:com.mauersu.util.redis.DefaultListOperations.java

public V rightPopAndLeftPush(K sourceKey, K destinationKey) {
    final byte[] rawDestKey = rawKey(destinationKey);

    return execute(new ValueDeserializingRedisCallback(sourceKey) {

        protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) {
            connection.select(dbIndex);//  w w  w.j  a v a  2  s .c o  m
            return connection.rPopLPush(rawSourceKey, rawDestKey);
        }
    }, true);
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value.
 * <p>/*from   w ww  .  j a v  a2  s  . c o m*/
 * See http://redis.io/commands/rpoplpush
 * 
 * @param srcKey srcKey
 * @param dstKey dstKey
 * @return byte[]
 */
public static byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.rPopLPush(srcKey, dstKey);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Remove the last element from list at {@code srcKey}, append it to {@code dstKey} and return its value.
 * <p>//from w  ww .j a  v a2 s  .co  m
 * See http://redis.io/commands/rpoplpush
 * 
 * @param srcKey srcKey
 * @param dstKey dstKey
 * @return byte[]
 */
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.rPopLPush(srcKey, dstKey);
        }
    });
}