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

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

Introduction

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

Prototype

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

Source Link

Document

Count number of elements within sorted set with scores between min and max .

Usage

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

public Long count(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 www.  j a  v a  2  s  .com*/
            return connection.zCount(rawKey, min, max);
        }
    }, true);
}

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

/**
 * Count number of elements within sorted set with scores between {@code min} and {@code max}.
 * <p>//from w ww .j  a v a  2  s .c  o m
 * See http://redis.io/commands/zcount
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public static Long zCount(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCount(key, min, max);
        }
    });
}

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

/**
 * Count number of elements within sorted set with scores between {@code min} and {@code max}.
 * <p>//from w w w.ja  va  2  s.  c o  m
 * See http://redis.io/commands/zcount
 * 
 * @param key key
 * @param min min
 * @param max max
 * @return Long
 */
public Long zCount(byte[] key, double min, double max) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCount(key, min, max);
        }
    });
}