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

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

Introduction

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

Prototype

@Nullable
Boolean hSet(byte[] key, byte[] field, byte[] value);

Source Link

Document

Set the value of a hash field .

Usage

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

public void put(K key, HK hashKey, HV value) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawHashKey = rawHashKey(hashKey);
    final byte[] rawHashValue = rawHashValue(value);

    execute(new RedisCallback<Object>() {

        public Object doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from   w w  w.  java 2s . c om
            connection.hSet(rawKey, rawHashKey, rawHashValue);
            return null;
        }
    }, true);
}

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

/**
 * Set the {@code value} of a hash {@code field}.
 * //from  ww w  . j  a  va2  s.  co m
 * @see http://redis.io/commands/hset
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public static Boolean hSet(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSet(key, field, value);
        }
    });
}

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

/**
 * Set the {@code value} of a hash {@code field}.
 * /*ww  w.j  a va2  s  . co m*/
 * @see http://redis.io/commands/hset
 * @param key key
 * @param field field
 * @param value value
 * @return Boolean
 */
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hSet(key, field, value);
        }
    });
}