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

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

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

Jedis.multi介绍

暂无

代码示例

代码示例来源:origin: qiurunze123/miaosha

/**
 * watch 监控多个key 一防止其他地方调用释放锁的时候对这个key进行修改 那么事务里面的代码就不会被执行 !
 */
  public boolean releaseLock(String key , String value){
    try {
      Jedis jedis = RedisManager.getJedis();
      while (true){
        jedis.watch(key);
        if(value.equals(jedis.get(key))){
          Transaction transaction = jedis.multi();
          transaction.del(key);
          List<Object> list = transaction.exec();
          if(list ==null){
            continue;
          }
          jedis.unwatch();
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return false;
  }
}

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

@Override
public void multi() {
  if (isQueueing()) {
    return;
  }
  try {
    if (isPipelined()) {
      getRequiredPipeline().multi();
      return;
    }
    this.transaction = jedis.multi();
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: Impetus/Kundera

Transaction bindResource(Jedis resource)
{
  Transaction tx = null;
  // Multi not supported.
  /*
   * if (resources.isEmpty()) {
   */
  tx = resource.multi();
  resources.add(tx);
  /*
   * } else { // tx = resource.multi(); // resources.add(tx); tx =
   * resources.get(0); }
   */return tx;
}

代码示例来源:origin: Exrick/x-boot

long now = System.currentTimeMillis();
Transaction transaction = jedis.multi();
long counter = (Long) results.get(results.size() - 1);
transaction = jedis.multi();
} else {
  transaction = jedis.multi();

代码示例来源:origin: ovea-deprecated/jetty-session-redis

@Override
  public List<Object> execute(Jedis jedis) {
    return jedis.multi(new TransactionBlock() {
      @Override
      public void execute() throws JedisException {
        for (String clusterId : clusterIds) {
          exists(REDIS_SESSION_KEY + clusterId);
        }
      }
    });
  }
});

代码示例来源:origin: org.apache.apex/malhar-contrib

@Override
public void beginTransaction()
{
 transaction = jedis.multi();
}

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

@Override
public Transaction multi() {
  Jedis jedis = this.getResource();
  return jedis.multi();
}

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

@Override
public <R> R withTransaction(Function<Transaction, R> f) {
 try (Jedis jedis = jedisPool.getResource()) {
  return f.apply(jedis.multi());
 }
}

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

@Override
public Transaction multi() {
 String command = "multi";
 return instrumented(command, () -> delegated.multi());
}

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

@Override
@Deprecated
public List<Object> multi(TransactionBlock jedisTransaction) {
 String command = "multi";
 return instrumented(command, () -> delegated.multi(jedisTransaction));
}

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

@Override
public void withTransaction(Consumer<Transaction> f) {
 try (Jedis jedis = jedisPool.getResource()) {
  f.accept(jedis.multi());
 }
}

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

@Override
  public Object execute(Jedis jedis) {
    Transaction transaction = jedis.multi();
    for (int i = 0; i < keyList.size(); i++) {
      transaction.set(keyList.get(i), valueList.get(i));
    }
    transaction.exec();
    return true;
  }
});

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

@Override
  public Object execute(Jedis jedis) {
    Transaction transaction = jedis.multi();
    for (int i = 0; i < keyList.size(); i++) {
      transaction.append(keyList.get(i), valueList.get(i));
      transaction.expire(keyList.get(i), seconds);
    }
    transaction.exec();
    return true;
  }
});

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

private RedisTransaction multi0(Jedis j) {
  Transaction t = j.multi();
  bind(j);
  return new DefaultRedisTransaction(j, t, this);
}

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

public Transaction multi() {
  Jedis jedis = getJedis();
  try {
    return jedis.multi();
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: xetorthio/rmq

public List<Object> multi(TransactionBlock transaction) {
  Jedis jedis = getResource();
  List<Object> multi = jedis.multi(transaction);
  returnResource(jedis);
  return multi;
}

代码示例来源:origin: xetorthio/johm

public List<Object> multi(TransactionBlock transaction) {
  Jedis jedis = getResource();
  List<Object> multi = jedis.multi(transaction);
  returnResource(jedis);
  return multi;
}

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

@Override
  public Object execute(Jedis jedis) {
    Transaction transaction = jedis.multi();
    transaction.append(key, value);
    transaction.expire(key, seconds);
    transaction.exec();
    return true;
  }
});

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

@Override
  Object execute() {
    Transaction transaction = jedis.getShard(key).multi();
    transaction.del(key);
    for (String value : values) {
      transaction.rpush(key, value);
    }
    transaction.exec();
    return null;
  }
}.getResult();

代码示例来源:origin: com.intoverflow.booster/booster-core

@Override
public void evict(Object key) {
  redisContext.run(jedis -> {
    byte[] keyBytes = toKeyBytes(key);
    Transaction multi = jedis.multi();
    multi.del(keyBytes);
    multi.zrem(keysetBytes, keyBytes);
    multi.exec();
  });
}

相关文章

Jedis类方法