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

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

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

Jedis.sdiff介绍

[英]Return the difference between the Set stored at key1 and all the Sets key2, ..., keyN

Example:

key1 = [x, a, b, c] 
key2 = [c] 
key3 = [a, d] 
SDIFF key1,key2,key3 => [x, b]

Non existing keys are considered like empty sets.

Time complexity:

O(N) with N being the total number of elements of all the sets
[中]

代码示例

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

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

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

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

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

/**
 * 返回一个集合的全部成员,该集合是所有给定集合之间的差集。
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sdiff(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sdiff(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[]> sDiff(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().sdiff(keys)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sdiff(keys)));
      return null;
    }
    return connection.getJedis().sdiff(keys);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

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

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

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

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

@Override
  public Object execute(Jedis jedis) {
    return jedis.sdiff(keys);
  }
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * 返回一个集合的全部成员,该集合是所有给定集合之间的差集。
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sdiff(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sdiff(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  }
  finally {close(jedis);}
}

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

/**
 * 返回一个集合的全部成员,该集合是所有给定集合之间的差集。
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sdiff(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sdiff(keysToBytesArray(keys));
    Set<Object> result = new HashSet<Object>();
    valueSetFromBytesSet(data, result);
    return result;
  } finally {
    returnResource(jedis);
  }
}

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

/**
 * 返回一个集合的全部成员,该集合是所有给定集合之间的差集。
 * 不存在的 key 被视为空集。
 */
@SuppressWarnings("rawtypes")
public Set sdiff(Object... keys) {
  Jedis jedis = getJedis();
  try {
    Set<byte[]> data = jedis.sdiff(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> sdiff(String... keys) {
 return this.run((jedis, serializer) ->
  EnoaRedisConvert.with(serializer).convertSet(jedis.sdiff(EnoaRedisConvert.with(serializer).toBytesKeys(keys))));
}

相关文章

Jedis类方法