redis.clients.jedis.Jedis.sunion()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中redis.clients.jedis.Jedis.sunion()方法的一些代码示例,展示了Jedis.sunion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.sunion()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:sunion

Jedis.sunion介绍

[英]Return the members of a set resulting from the union of all the sets hold at the specified keys. Like in #lrange(String,long,long) the result is sent to the client as a multi-bulk reply (see the protocol specification for more information). If just a single key is specified, then this command produces the same result as #smembers(String).

Non existing keys are considered like empty sets.

Time complexity O(N) where N is the total number of elements in all the provided sets
[中]返回在指定键处保留的所有集合的并集所产生的集合的成员。与#lrange(String,long,long)类似,结果将作为多批量回复发送到客户端(有关更多信息,请参阅协议规范)。如果只指定了一个键,则此命令将生成与#smembers(字符串)相同的结果。
不存在的键被视为空集。
时间复杂度O(N),其中N是所有提供集合中的元素总数

代码示例

代码示例来源:origin: sohutv/cachecloud

@Override
 public Set<byte[]> execute(Jedis connection) {
  return connection.sunion(keys);
 }
}.runBinary(keys.length, keys);

代码示例来源:origin: sohutv/cachecloud

@Override
 public Set<String> execute(Jedis connection) {
  return connection.sunion(keys);
 }
}.run(keys.length, keys);

代码示例来源:origin: jfinal/jfinal

/**
 * 返回多个集合的并集,多个集合由 keys 指定
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sunion(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sunion(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  }
  finally {close(jedis);}
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Set<byte[]> sUnion(byte[]... keys) {
  Assert.notNull(keys, "Keys must not be null!");
  Assert.noNullElements(keys, "Keys must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sunion(keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sunion(keys)));
      return null;
    }
    return connection.getJedis().sunion(keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
 public Set<String> execute(Jedis connection) {
  return connection.sunion(keys);
 }
}.run(keys.length, keys);

代码示例来源:origin: apache/servicemix-bundles

@Override
 public Set<byte[]> execute(Jedis connection) {
  return connection.sunion(keys);
 }
}.runBinary(keys.length, keys);

代码示例来源:origin: io.leopard/leopard-redis

@Override
public Set<String> sunion(String... keys) {
  return jedis.sunion(keys);
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public Set<String> sunion(String... keys) {
  return jedis.sunion(keys);
}

代码示例来源:origin: mindwind/craft-atom

private Set<String> sunion0(Jedis j, String... keys) {
  return j.sunion(keys);
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public Set<byte[]> sunion(byte[]... keys) {
  return master.sunion(keys);
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public Set<String> sunion(String... keys) {
  return master.sunion(keys);
}

代码示例来源:origin: com.github.biezhi/unique-support-redis

@Override
  Set<String> execute() {
    Jedis _jedis = jedis.getShard(keys[0]);
    return _jedis.sunion(keys);
  }
}.getResult();

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public Set<String> sunion(String... keys) {
 String command = "sunion";
 return instrumented(command, () -> delegated.sunion(keys));
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public Set<byte[]> sunion(byte[]... keys) {
 String command = "sunion";
 return instrumented(command, () -> delegated.sunion(keys));
}

代码示例来源:origin: wxiaoqi/ace-cache

@Override
public Set<String> sunion(String... keys) {
  Jedis jedis = null;
  Set<String> res = null;
  try {
    jedis = pool.getResource();
    res = jedis.sunion(keys);
  } catch (Exception e) {
    LOGGER.error(e.getMessage());
  } finally {
    returnResource(pool, jedis);
  }
  return res;
}

代码示例来源:origin: yangfuhai/jboot

/**
 * 返回多个集合的并集,多个集合由 keys 指定
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sunion(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sunion(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  } finally {
    returnResource(jedis);
  }
}

代码示例来源:origin: com.jfinal/jfinal

/**
 * 返回多个集合的并集,多个集合由 keys 指定
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sunion(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sunion(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  }
  finally {close(jedis);}
}

代码示例来源:origin: com.github.sogyf/goja-jfinal

/**
 * 返回多个集合的并集,多个集合由 keys 指定
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sunion(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sunion(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  }
  finally {close(jedis);}
}

代码示例来源:origin: io.enoa/nosql-redis

default <T> Set<T> sunion(String... keys) {
 return this.run((jedis, serializer) ->
  EnoaRedisConvert.with(serializer).convertSet(jedis.sunion(EnoaRedisConvert.with(serializer).toBytesKeys(keys))));
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Set<byte[]> sUnion(byte[]... keys) {
  Assert.notNull(keys, "Keys must not be null!");
  Assert.noNullElements(keys, "Keys must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sunion(keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sunion(keys)));
      return null;
    }
    return connection.getJedis().sunion(keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

微信公众号

最新文章

更多

Jedis类方法