Package redis.clients.jedis

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


  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


  Response<Set<Tuple>> zrangeWithScores = p.zrangeWithScores("zset", 0,
    -1);
  Response<String> getrange = p.getrange("setrange", 1, 3);
  Response<byte[]> getrangeBytes = p.getrange("setrangebytes".getBytes(),
    6, 8);
  p.sync();

  assertEquals("foo", string.get());
  assertEquals("foo", list.get());
  assertEquals("bar", hash.get());
  assertEquals("foo", zset.get().iterator().next());
View Full Code Here

    public void pipelineResponseWithData() {
  jedis.zadd("zset", 1, "foo");

  Pipeline p = jedis.pipelined();
  Response<Double> score = p.zscore("zset", "foo");
  p.sync();

  assertNotNull(score.get());
    }

    @Test
View Full Code Here

  Response<Map<byte[], byte[]>> fmap = p.hgetAll("key".getBytes());
  Response<Set<byte[]>> fkeys = p.hkeys("key".getBytes());
  Response<List<byte[]>> fordered = p.hmget("key".getBytes(),
    "f22".getBytes(), "f1".getBytes());
  Response<List<byte[]>> fvals = p.hvals("key".getBytes());
  p.sync();

  assertNotNull(fmap.get());
  // we have to do these strange contortions because byte[] is not a very
  // good key
  // for a java Map. It only works with equality (you need the exact key
View Full Code Here

    @Test
    public void pipelineSelect() {
  Pipeline p = jedis.pipelined();
  p.select(1);
  p.sync();
    }

    @Test
    public void pipelineResponseWithoutData() {
  jedis.zadd("zset", 1, "foo");
View Full Code Here

    public void pipelineResponseWithoutData() {
  jedis.zadd("zset", 1, "foo");

  Pipeline p = jedis.pipelined();
  Response<Double> score = p.zscore("zset", "bar");
  p.sync();

  assertNull(score.get());
    }

    @Test(expected = JedisDataException.class)
View Full Code Here

  jedis.set("string", "foo");

  Pipeline p = jedis.pipelined();
  Response<String> string = p.get("string");
  string.get();
  p.sync();
    }

    @Test
    public void pipelineWithPubSub() {
  Pipeline pipelined = jedis.pipelined();
View Full Code Here

    public void pipelineWithPubSub() {
  Pipeline pipelined = jedis.pipelined();
  Response<Long> p1 = pipelined.publish("foo", "bar");
  Response<Long> p2 = pipelined.publish("foo".getBytes(),
    "bar".getBytes());
  pipelined.sync();
  assertEquals(0, p1.get().longValue());
  assertEquals(0, p2.get().longValue());
    }

    @Test
View Full Code Here

    @Test
    public void canRetrieveUnsetKey() {
  Pipeline p = jedis.pipelined();
  Response<String> shouldNotExist = p.get(UUID.randomUUID().toString());
  p.sync();
  assertNull(shouldNotExist.get());
    }

    @Test
    public void piplineWithError() {
View Full Code Here

    public void piplineWithError() {
  Pipeline p = jedis.pipelined();
  p.set("foo", "bar");
  Response<Set<String>> error = p.smembers("foo");
  Response<String> r = p.get("foo");
  p.sync();
  try {
      error.get();
      fail();
  } catch (JedisDataException e) {
      // that is fine we should be here
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.