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

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

Introduction

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

Prototype

@Nullable
Long hLen(byte[] key);

Source Link

Document

Get size of hash at key .

Usage

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

public Long size(K key) {
    final byte[] rawKey = rawKey(key);

    return execute(new RedisCallback<Long>() {

        public Long doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//  w w  w .ja v  a2  s  .c  o  m
            return connection.hLen(rawKey);
        }
    }, true);
}

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

/**
 * Get size of hash at {@code key}./* www.  j  a va 2s .  c  o  m*/
 * 
 * @see http://redis.io/commands/hlen
 * @param key key
 * @return Long
 */
public static Long hLen(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hLen(key);
        }
    });
}

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

/**
 * Get size of hash at {@code key}./*from  w w  w.j a  v  a 2  s . c o  m*/
 * 
 * @see http://redis.io/commands/hlen
 * @param key key
 * @return Long
 */
public Long hLen(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hLen(key);
        }
    });
}