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

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

Introduction

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

Prototype

void lSet(byte[] key, long index, byte[] value);

Source Link

Document

Set the value list element at index .

Usage

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

public void set(K key, final long index, V value) {
    final byte[] rawValue = rawValue(value);
    execute(new ValueDeserializingRedisCallback(key) {

        protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
            connection.select(dbIndex);/*from w  w  w.jav  a  2 s.  c  o  m*/
            connection.lSet(rawKey, index, rawValue);
            return null;
        }
    }, true);
}

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

/**
 * Set the {@code value} list element at {@code index}.
 * <p>/*from   w w  w .ja  v  a  2 s .  co  m*/
 * See http://redis.io/commands/lset
 * 
 * @param key key
 * @param index index
 * @param value value
 */
public static void lSet(byte[] key, long index, byte[] value) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.lSet(key, index, value);
            return null;
        }
    });
}

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

/**
 * Set the {@code value} list element at {@code index}.
 * <p>/*from   ww w.  jav  a  2 s.c  om*/
 * See http://redis.io/commands/lset
 * 
 * @param key key
 * @param index index
 * @param value value
 */
public void lSet(byte[] key, long index, byte[] value) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.lSet(key, index, value);
            return null;
        }
    });
}