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

x33g5p2x  于2022-01-30 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(125)

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

Transaction.setbit介绍

暂无

代码示例

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

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

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

private void setbit0(String key, long offset, boolean value) {
  t.setbit(key, offset, value);
}

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

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

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

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

代码示例来源:origin: pyloque/captain

public int nextId(String name) {
  String key = keyFor(name);
  Holder<Integer> holder = new Holder<>();
  redis.execute(jedis -> {
    jedis.sadd(ALL_SEQS, name);
    long pos = 0;
    do {
      jedis.watch(key);
      pos = jedis.bitpos(key, false);
      if (pos < 0) {
        pos = 0;
      }
      Transaction tx = jedis.multi();
      tx.setbit(key, pos, true);
      if (tx.exec() != null) {
        break;
      }
    } while (true);
    holder.set((int) pos);
  });
  return holder.value();
}

代码示例来源:origin: Baqend/Orestes-Bloomfilter

if (!jedis.exists("test")) {
  Transaction ta = jedis.multi();
  ta.setbit("test", 100000, false);
  ta.exec();
ta.setbit("test", 10, true);
ta.exec();
  jedis.watch("testblob");
  for (int j = 0; j < size / 10; j++) {
    t.setbit("testblob", j, true);
    t.setbit("testblob", (int) (Math.random() * size), true);

相关文章

微信公众号

最新文章

更多

Transaction类方法