List of usage examples for org.springframework.data.redis.connection RedisConnection hMSet
void hMSet(byte[] key, Map<byte[], byte[]> hashes);
From source file:com.mauersu.util.redis.DefaultHashOperations.java
public void putAll(K key, Map<? extends HK, ? extends HV> m) { if (m.isEmpty()) { return;/*from w ww. j av a2s .c o m*/ } final byte[] rawKey = rawKey(key); final Map<byte[], byte[]> hashes = new LinkedHashMap<byte[], byte[]>(m.size()); for (Map.Entry<? extends HK, ? extends HV> entry : m.entrySet()) { hashes.put(rawHashKey(entry.getKey()), rawHashValue(entry.getValue())); } execute(new RedisCallback<Object>() { public Object doInRedis(RedisConnection connection) { connection.select(dbIndex); connection.hMSet(rawKey, hashes); return null; } }, true); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Set multiple hash fields to multiple values using data provided in {@code hashes} * /*from ww w. j av a 2 s .co m*/ * @see http://redis.io/commands/hmset * @param key key * @param hashes hashes */ public static void hMSet(byte[] key, Map<byte[], byte[]> hashes) { redisTemplate.execute(new RedisCallback<Void>() { @Override public Void doInRedis(RedisConnection redis) throws DataAccessException { redis.hMSet(key, hashes); return null; } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Set multiple hash fields to multiple values using data provided in {@code hashes} * /* ww w . ja v a 2s. c o m*/ * @see http://redis.io/commands/hmset * @param key key * @param hashes hashes */ public void hMSet(byte[] key, Map<byte[], byte[]> hashes) { redisTemplate.execute(new RedisCallback<Void>() { @Override public Void doInRedis(RedisConnection redis) throws DataAccessException { redis.hMSet(key, hashes); return null; } }); }