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

The following examples show how to use redis.clients.jedis.Jedis#sdiffstore() . 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中的差集并存入到另一个key中
 * </p>
 * <p>
 * 以第一个set为标准
 * </p>
 *
 * @param dstkey
 *            差集存入的key
 * @param keys
 *            可以使一个string 则返回set中所有的value 也可以是string数组
 * @return
 */
public Long sdiffstore(String dstkey, String... keys) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = jedisPool.getResource();
        res = jedis.sdiffstore(dstkey, keys);
    } catch (Exception e) {

        log.error(e.getMessage());
    } finally {
        returnResource(jedisPool, jedis);
    }
    return res;
}
 
Example 2
Source File: RedisServiceImpl.java    From ace-cache with Apache License 2.0 5 votes vote down vote up
@Override
public Long sdiffstore(String dstkey, String... keys) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = pool.getResource();
        res = jedis.sdiffstore(dstkey, keys);
    } catch (Exception e) {

        LOGGER.error(e.getMessage());
    } finally {
        returnResource(pool, jedis);
    }
    return res;
}
 
Example 3
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private Long sdiffstore0(Jedis j, String destination, String... keys) {
	return j.sdiffstore(destination, keys);
}
 
Example 4
Source File: JedisUtil.java    From Project with Apache License 2.0 3 votes vote down vote up
/**
 * 这个命令等于sdiff,但返回的不是结果集,而是将结果集存储在新的集合中,如果目标已存在,则覆盖。
 * 
 * @param newkey 新结果集的key
 * @param keys 比较的集合
 * @return 新集合中的记录数
 **/
public long sdiffstore(String newkey, String... keys) {
	Jedis jedis = getJedis();
	long s = jedis.sdiffstore(newkey, keys);
	jedis.close();
	return s;
}
 
Example 5
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 这个命令等于sdiff,但返回的不是结果集,而是将结果集存储在新的集合中,如果目标已存在,则覆盖。
 * 
 * @param String
 *            newkey 新结果集的key
 * @param String
 *            ... keys 比较的集合
 * @return 新集合中的记录数
 * **/
public long sdiffstore(String newkey, String... keys) {
	Jedis jedis = getJedis();
	long s = jedis.sdiffstore(newkey, keys);
	returnJedis(jedis);
	return s;
}