Package redis.clients.jedis

Examples of redis.clients.jedis.Transaction.exec()


      // atomically store ticket
      Transaction t = jedis.multi();
      t.set(key(repository, KeyType.ticket, ticketId), object);
      t.rpush(key(repository, KeyType.journal, ticketId), journal);
      t.exec();

      log.debug("updated ticket {} in Redis @ {}", "" + ticketId, getUrl());
      return true;
    } catch (JedisException e) {
      log.error("failed to update ticket cache in Redis @ " + getUrl(), e);
View Full Code Here


    try {
      Set<String> keys = jedis.keys(repository.name + ":*");
      if (keys.size() > 0) {
        Transaction t = jedis.multi();
        t.del(keys.toArray(new String[keys.size()]));
        t.exec();
      }
      success = true;
    } catch (JedisException e) {
      log.error("failed to delete all tickets in Redis @ " + getUrl(), e);
      pool.returnBrokenResource(jedis);
View Full Code Here

      Transaction t = jedis.multi();
      for (String oldKey : oldKeys) {
        String newKey = newRepository.name + oldKey.substring(oldKey.indexOf(':'));
        t.rename(oldKey, newKey);
      }
      t.exec();
      success = true;
    } catch (JedisException e) {
      log.error("failed to rename tickets in Redis @ " + getUrl(), e);
      pool.returnBrokenResource(jedis);
      jedis = null;
View Full Code Here

                } else {
                    Map<String, String> hash = this.buildConfigHash(builder);
                    jedis.watch(builder.name());
                    Transaction t = jedis.multi();
                    hash.forEach((k, v) -> t.hset(builder.name(), k, v));
                    if (t.exec() != null) {
                        newConfig = builder;
                    }
                }
            }
            return newConfig;
View Full Code Here

      // atomically store ticket
      Transaction t = jedis.multi();
      t.set(key(repository, KeyType.ticket, ticketId), object);
      t.rpush(key(repository, KeyType.journal, ticketId), journal);
      t.exec();

      log.debug("updated ticket {} in Redis @ {}", "" + ticketId, getUrl());
      return true;
    } catch (JedisException e) {
      log.error("failed to update ticket cache in Redis @ " + getUrl(), e);
View Full Code Here

    try {
      Set<String> keys = jedis.keys(repository.name + ":*");
      if (keys.size() > 0) {
        Transaction t = jedis.multi();
        t.del(keys.toArray(new String[keys.size()]));
        t.exec();
      }
      success = true;
    } catch (JedisException e) {
      log.error("failed to delete all tickets in Redis @ " + getUrl(), e);
      pool.returnBrokenResource(jedis);
View Full Code Here

      Transaction t = jedis.multi();
      for (String oldKey : oldKeys) {
        String newKey = newRepository.name + oldKey.substring(oldKey.indexOf(':'));
        t.rename(oldKey, newKey);
      }
      t.exec();
      success = true;
    } catch (JedisException e) {
      log.error("failed to rename tickets in Redis @ " + getUrl(), e);
      pool.returnBrokenResource(jedis);
      jedis = null;
View Full Code Here

    try {
      // atomically remove ticket
      Transaction t = jedis.multi();
      t.del(key(repository, KeyType.ticket, ticket.number));
      t.del(key(repository, KeyType.journal, ticket.number));
      t.exec();

      success = true;
      log.debug("deleted ticket {} from Redis @ {}", "" + ticket.number, getUrl());
    } catch (JedisException e) {
      log.error("failed to delete ticket from Redis @ " + getUrl(), e);
View Full Code Here

        List<?> result = null;
        Jedis jedis = pool.getResource();
        try {
            Transaction trans = jedis.multi();
            jedisAtom.action(trans);
            result = trans.exec();
        }catch (Exception e){
            LOG.error(e.getMessage(), e);
        }finally {
            if(null != jedis){
                pool.returnResource(jedis);
View Full Code Here

    BinaryJedis jedis = (BinaryJedis) connection.getNativeConnection();
    Transaction multi = jedis.multi();
    //connection.set(key, value);
    multi.set(value, key);
    System.out.println(multi.exec());

    connection.multi();
    connection.set(value, key);
    System.out.println(connection.exec());
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.