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

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

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

Jedis.sunionstore介绍

[英]This command works exactly like #sunion(String...) but instead of being returned the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.

Time complexity O(N) where N is the total number of elements in all the provided sets
[中]此命令的工作方式与#sunion(字符串…)完全相同但结果集并没有返回,而是存储为dstkey。dstkey中的任何现有值都将被重写。
时间复杂度O(N),其中N是所有提供集合中的元素总数

代码示例

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

@Override
 public Long execute(Jedis connection) {
  return connection.sunionstore(dstkey, keys);
 }
}.runBinary(wholeKeys.length, wholeKeys);

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

@Override
 public Long execute(Jedis connection) {
  return connection.sunionstore(dstkey, keys);
 }
}.run(wholeKeys.length, wholeKeys);

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

@Override
public Long sUnionStore(byte[] destKey, byte[]... keys) {
  Assert.notNull(destKey, "Destination key must not be null!");
  Assert.notNull(keys, "Source keys must not be null!");
  Assert.noNullElements(keys, "Source keys must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sunionstore(destKey, keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sunionstore(destKey, keys)));
      return null;
    }
    return connection.getJedis().sunionstore(destKey, keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
 public Long execute(Jedis connection) {
  return connection.sunionstore(dstkey, keys);
 }
}.run(wholeKeys.length, wholeKeys);

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

@Override
 public Long execute(Jedis connection) {
  return connection.sunionstore(dstkey, keys);
 }
}.runBinary(wholeKeys.length, wholeKeys);

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

@Override
public Long sunionstore(String dstkey, String... keys) {
  return jedis.sunionstore(dstkey, keys);
}

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

@Override
public Long sunionstore(String dstkey, String... keys) {
  return jedis.sunionstore(dstkey, keys);
}

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

private Long sunionstore0(Jedis j, String destination, String... keys) {
  return j.sunionstore(destination, keys);
}

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

public Long sunionstore(byte[] dstkey, byte[]... keys) {
  return master.sunionstore(dstkey, keys);
}

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

public Long sunionstore(String dstkey, String... keys) {
  return master.sunionstore(dstkey, keys);
}

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

@Override
public Long sunionstore(byte[] dstkey, byte[]... keys) {
 String command = "sunionstore";
 return instrumented(command, () -> delegated.sunionstore(dstkey, keys));
}

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

@Override
public Long sunionstore(String dstkey, String... keys) {
 String command = "sunionstore";
 return instrumented(command, () -> delegated.sunionstore(dstkey, keys));
}

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

default Long sunionstore(String dstkey, String... keys) {
 return this.run((jedis, serializer) -> jedis.sunionstore(dstkey, keys));
}

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

@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;
}

代码示例来源:origin: chenjunwen/SpringBootFrame

/**
 * <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 = pool.getResource();
    res = jedis.sunionstore(dstkey, keys);
  } catch (Exception e) {
    LOGGER.error(e.getMessage());
  } finally {
    returnResource(pool, jedis);
  }
  return res;
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

/**
 * This command works exactly like {@link #sunion(byte[]...) SUNION} but instead of being returned
 * the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.
 * <p>
 * Time complexity O(N) where N is the total number of elements in all the provided sets
 *
 * @param dstkey
 * @param keys
 * @return Status code reply
 */
public Long sunionstore(byte[] dstkey, byte[]... keys) {
  Jedis jedis = getJedis();
  try {
    return jedis.sunionstore(dstkey, keys);
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

/**
 * This command works exactly like {@link #sunion(String...) SUNION} but instead of being returned
 * the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.
 * <p>
 * Time complexity O(N) where N is the total number of elements in all the provided sets
 *
 * @param dstkey
 * @param keys
 * @return Status code reply
 */
public Long sunionstore(String dstkey, String... keys) {
  Jedis jedis = getJedis();
  try {
    return jedis.sunionstore(dstkey, keys);
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: youtongluan/sumk

@Override
public java.lang.Long sunionstore(java.lang.String dstkey, java.lang.String... keys) {
  Exception e1 = null;
  for (int i = 0; i < tryCount; i++) {
    Jedis jedis = null;
    try {
      jedis = pool.getResource();
      return jedis.sunionstore(dstkey, keys);
    } catch (Exception e) {
      if (isConnectException(e)) {
        Log.get(LOG_NAME).error(this.hosts + " - redis connection failed,idle=" + pool.getNumIdle()
            + ",active=" + pool.getNumActive(), e);
        e1 = e;
        continue;
      }
      Log.get(LOG_NAME).error("sunionstore - redis execute error!" + e.getMessage(), e);
      SumkException.throwException(12342411, e.getMessage(), e);
    } finally {
      close(jedis);
    }
  }
  handleRedisException(e1);
  throw new SumkException(12342423, "未知redis异常");
}

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

@Override
public Long sUnionStore(byte[] destKey, byte[]... keys) {
  Assert.notNull(destKey, "Destination key must not be null!");
  Assert.notNull(keys, "Source keys must not be null!");
  Assert.noNullElements(keys, "Source keys must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sunionstore(destKey, keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sunionstore(destKey, keys)));
      return null;
    }
    return connection.getJedis().sunionstore(destKey, keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public Long sUnionStore(byte[] destKey, byte[]... keys) {
  Assert.notNull(destKey, "Destination key must not be null!");
  Assert.notNull(keys, "Source keys must not be null!");
  Assert.noNullElements(keys, "Source keys must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sunionstore(destKey, keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sunionstore(destKey, keys)));
      return null;
    }
    return connection.getJedis().sunionstore(destKey, keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

Jedis类方法