Package redis.clients.jedis

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


  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());
  // It should be readable whether exec's response was built or not
  assertEquals("314", r2.get());
View Full Code Here


  Pipeline pipeline = jedis.pipelined();
  pipeline.multi();
  pipeline.set("foo", "bar");
  Response<String> discard = pipeline.discard();
  Response<String> get = pipeline.get("foo");
  pipeline.sync();
  discard.get();
  get.get();
    }

    @Test
View Full Code Here

    public void testEval() {
  String script = "return 'success!'";

  Pipeline p = jedis.pipelined();
  Response<String> result = p.eval(script);
  p.sync();

  assertEquals("success!", result.get());
    }

    @Test
View Full Code Here

    Arrays.asList(arg));
  p.incr(key);
  Response<String> result1 = p.eval(script, Arrays.asList(key),
    Arrays.asList(arg));
  Response<String> result2 = p.get(key);
  p.sync();

  assertNull(result0.get());
  assertNull(result1.get());
  assertEquals("13", result2.get());
    }
View Full Code Here

  assertTrue(jedis.scriptExists(sha1));

  Pipeline p = jedis.pipelined();
  Response<String> result = p.evalsha(sha1);
  p.sync();

  assertEquals("success!", result.get());
    }

    @Test
View Full Code Here

    Arrays.asList(arg));
  p.incr(key);
  Response<String> result1 = p.evalsha(sha1, Arrays.asList(key),
    Arrays.asList(arg));
  Response<String> result2 = p.get(key);
  p.sync();

  assertNull(result0.get());
  assertNull(result1.get());
  assertEquals("13", result2.get());
    }
View Full Code Here

  bh.put(bbar, bcar);
  bh.put(bcar, bbar);
  jedis.hmset(bfoo, bh);
  Pipeline pipeline = jedis.pipelined();
  Response<Map<byte[], byte[]>> bhashResponse = pipeline.hgetAll(bfoo);
  pipeline.sync();
  Map<byte[], byte[]> bhash = bhashResponse.get();

  assertEquals(2, bhash.size());
  assertArrayEquals(bcar, bhash.get(bbar));
  assertArrayEquals(bbar, bhash.get(bcar));
View Full Code Here

  for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
      String key = "foo" + n;
      p.set(key, "bar" + n);
      p.get(key);
  }
  p.sync();

  long elapsed = Calendar.getInstance().getTimeInMillis() - begin;

  jedis.disconnect();
View Full Code Here

            List<Long> counts;
            List<Response<Long>> responses = new ArrayList<>(config().hashes());
            for (String position : hashesString) {
                responses.add(p.hincrBy(keys.COUNTS_KEY, position, -1));
            }
            p.sync();
            counts = responses.stream().map(Response::get).collect(Collectors.toList());

            while (true) {
                p = jedis.pipelined();
                p.multi();
View Full Code Here

                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);
                    p.sync();
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.