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

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

Introduction

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

Prototype

void lTrim(byte[] key, long start, long end);

Source Link

Document

Trim list at key to elements between start and end .

Usage

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

public void trim(K key, final long start, final long end) {
    execute(new ValueDeserializingRedisCallback(key) {

        protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
            connection.select(dbIndex);//ww  w .  j  av  a2  s .c  o m
            connection.lTrim(rawKey, start, end);
            return null;
        }
    }, true);
}

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

/**
 * Trim list at {@code key} to elements between {@code begin} and {@code end}.
 * <p>//w w w  . j a  v a  2s  .c  o m
 * See http://redis.io/commands/ltrim
 * 
 * @param key key
 * @param begin begin
 * @param end end
 */
public static void lTrim(byte[] key, long begin, long end) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.lTrim(key, begin, end);
            return null;
        }
    });
}

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

/**
 * Trim list at {@code key} to elements between {@code begin} and {@code end}.
 * <p>//from w  w  w.ja  v  a  2 s.com
 * See http://redis.io/commands/ltrim
 * 
 * @param key key
 * @param begin begin
 * @param end end
 */
public void lTrim(byte[] key, long begin, long end) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.lTrim(key, begin, end);
            return null;
        }
    });
}