Java Code Examples for redis.clients.jedis.ShardedJedis#hmset()

The following examples show how to use redis.clients.jedis.ShardedJedis#hmset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShardedRedisCache.java    From framework with Apache License 2.0 6 votes vote down vote up
/**
 * Description: <br>
 * 
 * @author 王伟<br>
 * @taskId <br>
 * @param key
 * @param dataMap <br>
 */
@Override
protected void putNode(final byte[] key, final Map<byte[], byte[]> dataMap) {
    if (MapUtils.isNotEmpty(dataMap)) {
        ShardedJedis shardedJedis = null;
        try {
            shardedJedis = shardedPool.getResource();
            shardedJedis.hmset(key, dataMap);
        }
        finally {
            if (shardedJedis != null) {
                shardedJedis.close();
            }
        }
    }

}
 
Example 2
Source File: RedisServiceImpl.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean saveMap(final String key, final Map<String, String> value, final int expire) {
	checkParameters(key, value);

	final ShardedJedis jedis = getJedis();
	final String result = jedis.hmset(key, value);
	jedis.expire(key, expire);

	returnResource(jedis);
	return SUCCESS.equalsIgnoreCase(result);
}
 
Example 3
Source File: RedisServiceImpl.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean hmset(final String key, final Map<String, String> hash, final int expire) {
	checkParameters(key, hash);

	final ShardedJedis jedis = getJedis();
	try {
		final String result = jedis.hmset(key, hash);
		jedis.expire(key, expire);
		return SUCCESS.equalsIgnoreCase(result);
	} catch (final JedisConnectionException e) {
		throw new MapRedisException("method: hmset, key:" + key, e);
	} finally {
		returnResource(jedis);
	}
}