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

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

Introduction

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

Prototype

@Nullable
byte[] lIndex(byte[] key, long index);

Source Link

Document

Get element at index form list at key .

Usage

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

public V index(K key, final long index) {
    return execute(new ValueDeserializingRedisCallback(key) {

        protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
            connection.select(dbIndex);//from  w w w .  java  2s.c o m
            return connection.lIndex(rawKey, index);
        }
    }, true);
}

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

/**
 * Get element at {@code index} form list at {@code key}.
 * <p>//  w  ww . j  a va 2s.c o m
 * See http://redis.io/commands/lindex
 * 
 * @param key key
 * @param index index
 * @return byte[]
 */
public static byte[] lIndex(byte[] key, long index) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lIndex(key, index);
        }
    });
}

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

/**
 * Get element at {@code index} form list at {@code key}.
 * <p>/*from   w  w  w.ja v  a  2 s.  c om*/
 * See http://redis.io/commands/lindex
 * 
 * @param key key
 * @param index index
 * @return byte[]
 */
public byte[] lIndex(byte[] key, long index) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lIndex(key, index);
        }
    });
}