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

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

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

Jedis.sismember介绍

[英]Return true if member is a member of the set stored at key, otherwise false is returned.

Time complexity O(1)
[中]如果成员是存储在密钥处的集合的成员,则返回true,否则返回false。
时间复杂度O(1)

代码示例

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

@Override
 public Boolean execute(Jedis connection) {
  return connection.sismember(key, member);
 }
}.runBinary(key);

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

@Override
 public Boolean execute(Jedis connection) {
  return connection.sismember(key, member);
 }
}.run(key);

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

public Boolean execute(Jedis connection) {
    return connection.sismember(keyByte, member);
  }
}.runBinary(keyByte);

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

@Override
public Boolean sismember(String key, String member) {
 Jedis j = getShard(key);
 return j.sismember(key, member);
}

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

@Override
public Boolean sismember(byte[] key, byte[] member) {
 Jedis j = getShard(key);
 return j.sismember(key, member);
}

代码示例来源:origin: Netflix/conductor

@Override
public Boolean sismember(String key, String member) {
 Jedis jedis = null;
  try {
   jedis = jedisPool.getResource();
   return jedis.sismember(key, member);
  } finally {
   if (jedis != null)
    jedis.close();
  }
}

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

/**
 * 判断 member 元素是否集合 key 的成员。
 */
public boolean sismember(Object key, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.sismember(keyToBytes(key), valueToBytes(member));
  }
  finally {close(jedis);}
}

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

@Override
public Boolean sIsMember(byte[] key, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().sismember(key, value)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().sismember(key, value)));
      return null;
    }
    return connection.getJedis().sismember(key, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: jwpttcg66/NettyGameServer

/**
 * 检测是否是成员
 * @param key
 * @param member
 * @return
 */
public boolean sexists(String key , String member){
  Jedis jedis = null;
  boolean sucess = true;
  try {
    jedis = jedisPool.getResource();
    return jedis.sismember(key, member);
  } catch (Exception e) {
    sucess = false;
    returnBrokenResource(jedis, "hexists", e);
  } finally {
    if (sucess && jedis != null) {
      returnResource(jedis);
    }
  }
  return false;
}

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

@Override
  public Object execute(Jedis jedis) {
    return jedis.sismember(key, member);
  }
});

代码示例来源:origin: Sunybyjava/wenda

/**
 * 判断是否在set里面,1则表示在,0=则表示不存在
 */
public boolean sismember(String key, String value) {
  try (Jedis jedis = jedisPool.getResource()) {
    return jedis.sismember(key, value);
  } catch (Exception e) {
    logger.error("发生异常" + e.getMessage());
  }
  return false;
}

代码示例来源:origin: gresrun/jesque

/**
   * {@inheritDoc}
   */
  @Override
  public WorkerInfo doWork(final Jedis jedis) throws Exception {
    WorkerInfo workerInfo = null;
    if (jedis.sismember(key(WORKERS), workerName)) {
      workerInfo = createWorker(workerName, jedis);
    }
    return workerInfo;
  }
});

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

@Override
public Boolean sismember(final byte[] key, final byte[] member) {
 Jedis j = getShard(key);
 return j.sismember(key, member);
}

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

@Override
public Boolean sismember(String key, String member) {
 String command = "sismember";
 return instrumented(command, () -> delegated.sismember(key, member));
}

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

@Override
public Boolean sismember(byte[] key, byte[] member) {
 String command = "sismember";
 return instrumented(command, () -> delegated.sismember(key, member));
}

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

/**
 * 判断 member 元素是否集合 key 的成员。
 */
public boolean sismember(Object key, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.sismember(keyToBytes(key), valueToBytes(member));
  } finally {
    returnResource(jedis);
  }
}

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

/**
 * 判断 member 元素是否集合 key 的成员。
 */
public boolean sismember(Object key, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.sismember(keyToBytes(key), valueToBytes(member));
  }
  finally {close(jedis);}
}

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

/**
 * 判断 member 元素是否集合 key 的成员。
 */
public boolean sismember(Object key, Object member) {
  Jedis jedis = getJedis();
  try {
    return jedis.sismember(keyToBytes(key), valueToBytes(member));
  }
  finally {close(jedis);}
}

代码示例来源:origin: xiancloud/xian

@Override
public void execute(UnitRequest msg, Handler<UnitResponse> handler) throws Exception {
  String key = msg.get("key", String.class);
  Object member = msg.get("member", Object.class);
  CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
  Boolean result = Redis.call(cacheConfigBean, jedis -> jedis.sismember(key, FormatUtil.formatValue(member)));
  handler.handle(UnitResponse.createSuccess(result));
}

代码示例来源:origin: com.almende.eve/eve-state-redis

public RedisState get(final ObjectNode params) {
  final RedisStateConfig config = new RedisStateConfig(params);
  final RedisState result = new RedisState(config.getId(), this,
      config);
  Jedis redis = getInstance();
  if (!redis.sismember(IDKEY, config.getId())) {
    redis.sadd(IDKEY, config.getId());
  }
  returnInstance(redis);
  return result;
}

相关文章

Jedis类方法