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

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

Introduction

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

Prototype

@Nullable
Long lRem(byte[] key, long count, byte[] value);

Source Link

Document

Removes the first count occurrences of value from the list stored at key .

Usage

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

public Long remove(K key, final long count, Object value) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawValue = rawValue(value);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from   w  ww  . j  a v a  2  s .  co m
            return connection.lRem(rawKey, count, rawValue);
        }
    }, true);
}

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

/**
 * Removes the first {@code count} occurrences of {@code value} from the list stored at {@code key}.
 * <p>//ww w .  j  a  v  a 2  s  . c  om
 * See http://redis.io/commands/lrem
 * 
 * @param key key
 * @param count count
 * @param value value
 * @return Long
 */
public static Long lRem(byte[] key, long count, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lRem(key, count, value);
        }
    });
}

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

/**
 * Removes the first {@code count} occurrences of {@code value} from the list stored at {@code key}.
 * <p>/*from  w  w w.j a  va  2s  .c  o m*/
 * See http://redis.io/commands/lrem
 * 
 * @param key key
 * @param count count
 * @param value value
 * @return Long
 */
public Long lRem(byte[] key, long count, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.lRem(key, count, value);
        }
    });
}