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

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

Introduction

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

Prototype

@Nullable
Long lPush(byte[] key, byte[]... values);

Source Link

Document

Prepend values to key .

Usage

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

public Long leftPushAll(K key, V... values) {
    final byte[] rawKey = rawKey(key);
    final byte[][] rawValues = rawValues(values);
    return execute(new RedisCallback<Long>() {
        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*from  w w w  .j  a v a2s .  c o  m*/
            return connection.lPush(rawKey, rawValues);
        }
    }, true);
}

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

public Long leftPush(K key, V value) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawValue = rawValue(value);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//www .j a v a  2 s .  c o  m
            return connection.lPush(rawKey, rawValue);
        }
    }, true);
}

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

/**
 * Prepend {@code values} to {@code key}.
 * <p>/*  ww w . j  a v a  2 s .c om*/
 * See http://redis.io/commands/lpush
 * 
 * @param key key
 * @param values values
 * @return Long
 */
public static Long lPush(byte[] key, byte[]... values) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lPush(key, values);
        }
    });
}

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

/**
 * Prepend {@code values} to {@code key}.
 * <p>//from w  w  w. ja  va  2s .  c  o m
 * See http://redis.io/commands/lpush
 * 
 * @param key key
 * @param values values
 * @return Long
 */
public Long lPush(byte[] key, byte[]... values) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lPush(key, values);
        }
    });
}