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

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

Introduction

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

Prototype

@Nullable
Long zCard(byte[] key);

Source Link

Document

Get the size of sorted set with key .

Usage

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

@Override
public Long zCard(K key) {

    final byte[] rawKey = rawKey(key);
    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from ww w .ja va 2 s  . co m
            return connection.zCard(rawKey);
        }
    }, true);
}

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

/**
 * Get the size of sorted set with {@code key}.
 * <p>// w  w  w .  j a v  a 2  s  .c o m
 * See http://redis.io/commands/zcard
 * 
 * @param key key
 * @return Long
 */
public static Long zCard(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCard(key);
        }
    });
}

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

/**
 * Get the size of sorted set with {@code key}.
 * <p>/*from w  w w.  j a v a 2s.c  o m*/
 * See http://redis.io/commands/zcard
 * 
 * @param key key
 * @return Long
 */
public Long zCard(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.zCard(key);
        }
    });
}