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

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

Introduction

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

Prototype

@Nullable
byte[] hGet(byte[] key, byte[] field);

Source Link

Document

Get value for given field from hash at key .

Usage

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

@SuppressWarnings("unchecked")
public HV get(K key, Object hashKey) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawHashKey = rawHashKey(hashKey);

    byte[] rawHashValue = execute(new RedisCallback<byte[]>() {

        public byte[] doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*  www .j  a va  2 s  .c o m*/
            return connection.hGet(rawKey, rawHashKey);
        }
    }, true);

    return (HV) deserializeHashValue(rawHashValue);
}

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

/**
 * Get value for given {@code field} from hash at {@code key}.
 * //from  w w w .j  ava  2  s  .com
 * @see http://redis.io/commands/hget
 * @param key key
 * @param field field
 * @return byte[
 */
public static byte[] hGet(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGet(key, field);
        }
    });
}

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

/**
 * Get value for given {@code field} from hash at {@code key}.
 * /*from  www. j  ava2s.  c  o m*/
 * @see http://redis.io/commands/hget
 * @param key key
 * @param field field
 * @return byte[
 */
public byte[] hGet(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGet(key, field);
        }
    });
}