Package redis.clients.jedis

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


  pipeline.get(key1);
  pipeline.hgetAll(key2);
  pipeline.hgetAll(key3);
  pipeline.get(key4);

  Response<List<Object>> response = pipeline.exec();
  pipeline.sync();

  List<Object> result = response.get();

  assertEquals(4, result.size());
View Full Code Here


    public void multi() {
  Pipeline p = jedis.pipelined();
  p.multi();
  Response<Long> r1 = p.hincrBy("a", "f1", -1);
  Response<Long> r2 = p.hincrBy("a", "f1", -2);
  Response<List<Object>> r3 = p.exec();
  List<Object> result = p.syncAndReturnAll();

  assertEquals(new Long(-1), r1.get());
  assertEquals(new Long(-3), r2.get());
View Full Code Here

  jedis.set("hello", "world");
  Pipeline p = jedis.pipelined();
  Response<String> r1 = p.get("bar");
  p.multi();
  Response<String> r2 = p.get("foo");
  p.exec();
  Response<String> r3 = p.get("hello");
  p.sync();

  // before multi
  assertEquals("foo", r1.get());
View Full Code Here

    }

    @Test(expected = JedisDataException.class)
    public void pipelineExecShoudThrowJedisDataExceptionWhenNotInMulti() {
  Pipeline pipeline = jedis.pipelined();
  pipeline.exec();
    }

    @Test(expected = JedisDataException.class)
    public void pipelineDiscardShoudThrowJedisDataExceptionWhenNotInMulti() {
  Pipeline pipeline = jedis.pipelined();
View Full Code Here

                p.multi();
                for (int i = 0; i < config().hashes(); i++) {
                    if (counts.get(i) <= 0)
                        bloom.set(p, hashes[i], false);
                }
                Response<List<Object>> exec = p.exec();
                p.sync();
                if (exec.get() == null) {
                    p = jedis.pipelined();
                    p.watch(keys.COUNTS_KEY, keys.BITS_KEY);
                    Response<List<String>> hmget = p.hmget(keys.COUNTS_KEY, hashesString);
View Full Code Here

                p.multi();
                for (int i = 0; i < config().hashes(); i++) {
                    if (counts.get(i) <= 0)
                        bloom.set(p, hashes[i], false);
                }
                Response<List<Object>> exec = p.exec();
                p.sync();
                if (exec.get() == null) {
                    p = jedis.pipelined();
                    p.watch(keys.COUNTS_KEY, keys.BITS_KEY);
                    Response<List<String>> hmget = p.hmget(keys.COUNTS_KEY, hashesString);
View Full Code Here

        if (item != null){
            pipe.zadd("viewed:" + token, timestamp, item);
            pipe.zremrangeByRank("viewed:" + token, 0, -26);
            pipe.zincrby("viewed:", -1, item);
        }
        pipe.exec();
    }
}
View Full Code Here

       
        for (Entry<Double, String> entry : dates.entrySet()) {
          pipeline.zadd(redisHtsDaysKey, entry.getKey(), entry.getValue());
        }
            
        pipeline.exec();
        pipeline.sync();
        getJedisPool().returnResource(jedis);
      } catch (Exception e) {
        s_logger.error("Unable to put timeseries with id: " + redisKey, e);
        getJedisPool().returnBrokenResource(jedis);
View Full Code Here

    pipeline.multi();
    for (ExternalId identifier : securities) {
      String redisKey = generateRedisKey(identifier.getScheme().getName(), identifier.getValue(), getNormalizationRuleSetId());
      pipeline.hgetAll(redisKey);
    }
    Response<List<Object>> response = pipeline.exec();
    pipeline.sync();
   
    final Iterator<ExternalId> allSecItr = securities.iterator();
    final Iterator<Object> responseItr = response.get().iterator();
    while (responseItr.hasNext() && allSecItr.hasNext()) {
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.