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
Long zCount(byte[] key, Range range);

Source Link

Document

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

Usage

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

/**
 * Count number of elements within sorted set with scores between {@code Range#min} and {@code Range#max}.
 * /*from  w w  w . j  av  a2  s.  com*/
 * @param key key
 * @param range range
 * @return Long
 * @since 1.6
 */
public static Long zCount(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCount(key, range);
        }
    });
}

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

/**
 * Count number of elements within sorted set with scores between {@code Range#min} and {@code Range#max}.
 * /*w  w  w. j a v  a 2 s.com*/
 * @param key key
 * @param range range
 * @return Long
 * @since 1.6
 */
public Long zCount(byte[] key, Range range) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCount(key, range);
        }
    });
}