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

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

Introduction

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

Prototype

@Nullable
default Long zRemRangeByScore(byte[] key, double min, double max) 

Source Link

Document

Remove elements with scores between min and max from sorted set with key .

Usage

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

public Long removeRangeByScore(K key, final double min, final double max) {
    final byte[] rawKey = rawKey(key);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from   w  ww  .j a va  2s  . c  om
            return connection.zRemRangeByScore(rawKey, min, max);
        }
    }, true);
}

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

/**
 * Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
 * <p>/*from   w w w  . j a  va 2 s.  co m*/
 * See http://redis.io/commands/zremrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public static Long zRemRangeByScore(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, min, max);
        }
    });
}

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

/**
 * Remove elements with scores between {@code min} and {@code max} from sorted set with {@code key}.
 * <p>/*from  ww  w  .j av a2s  .c o  m*/
 * See http://redis.io/commands/zremrangebyscore
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public Long zRemRangeByScore(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zRemRangeByScore(key, min, max);
        }
    });
}