Java Code Examples for redis.clients.jedis.Jedis#sunionstore()

The following examples show how to use redis.clients.jedis.Jedis#sunionstore() . 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: JedisUtils.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * 通过key返回所有set的并集,并存入到新的set中
 * </p>
 *
 * @param dstkey
 * @param keys
 *            可以使一个string 也可以是一个string数组
 * @return
 */
public Long sunionstore(String dstkey, String... keys) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = jedisPool.getResource();
        res = jedis.sunionstore(dstkey, keys);
    } catch (Exception e) {

        log.error(e.getMessage());
    } finally {
        returnResource(jedisPool, jedis);
    }
    return res;
}
 
Example 2
Source File: JedisUtil.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
 * 合并多个集合并将合并后的结果集保存在指定的新集合中,如果新集合已经存在则覆盖
 * 
 * @param  newkey 新集合的key
 * @param  keys 要合并的集合
 **/
public long sunionstore(String newkey, String... keys) {
	Jedis jedis = getJedis();
	long s = jedis.sunionstore(newkey, keys);
	jedis.close();
	return s;
}
 
Example 3
Source File: RedisServiceImpl.java    From ace-cache with Apache License 2.0 5 votes vote down vote up
@Override
public Long sunionstore(String dstkey, String... keys) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = pool.getResource();
        res = jedis.sunionstore(dstkey, keys);
    } catch (Exception e) {

        LOGGER.error(e.getMessage());
    } finally {
        returnResource(pool, jedis);
    }
    return res;
}
 
Example 4
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private Long sunionstore0(Jedis j, String destination, String... keys) {
	return j.sunionstore(destination, keys);
}
 
Example 5
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 合并多个集合并将合并后的结果集保存在指定的新集合中,如果新集合已经存在则覆盖
 * 
 * @param String
 *            newkey 新集合的key
 * @param String
 *            ... keys 要合并的集合
 * **/
public long sunionstore(String newkey, String... keys) {
	Jedis jedis = getJedis();
	long s = jedis.sunionstore(newkey, keys);
	returnJedis(jedis);
	return s;
}