Package net.rubyeye.xmemcached.transcoders

Examples of net.rubyeye.xmemcached.transcoders.StringTranscoder


  public void testStoreNoReply() throws Exception {
    memcachedClient.replaceWithNoReply("name", 0, 1);
    assertNull(memcachedClient.get("name"));

    memcachedClient.setWithNoReply("name", 1, "dennis",
        new StringTranscoder());
    assertEquals("dennis", memcachedClient.get("name"));
    Thread.sleep(2000);
    assertNull(memcachedClient.get("name"));

    memcachedClient.setWithNoReply("name", 0, "dennis",
        new StringTranscoder());
    memcachedClient.appendWithNoReply("name", " zhuang");
    memcachedClient.prependWithNoReply("name", "hello ");
    assertEquals("hello dennis zhuang", memcachedClient.get("name"));

    memcachedClient.addWithNoReply("name", 0, "test",
        new StringTranscoder());
    assertEquals("hello dennis zhuang", memcachedClient.get("name"));
    memcachedClient.replaceWithNoReply("name", 0, "test",
        new StringTranscoder());
    assertEquals("test", memcachedClient.get("name"));

    memcachedClient.setWithNoReply("a", 0, 1);
    GetsResponse<Integer> getsResponse = memcachedClient.gets("a");
    memcachedClient.casWithNoReply("a", 0, getsResponse,
View Full Code Here


  @Override
  @Test
  public void testTouch() throws Exception {
    if (this.isMemcached1_6()) {
      assertNull(this.memcachedClient.get("name"));
      this.memcachedClient.set("name", 1, "dennis", new StringTranscoder(),
          1000);
      assertEquals("dennis", this.memcachedClient.get("name",
          new StringTranscoder()));

      // touch expiration to three seconds
      System.out.println(this.memcachedClient.touch("name", 3));
      Thread.sleep(2000);
      assertEquals("dennis", this.memcachedClient.get("name",
          new StringTranscoder()));
      Thread.sleep(1500);
      assertNull(this.memcachedClient.get("name"));
    }
  }
View Full Code Here

  @Test
  public void testGetAndTouch_OneKey() throws Exception {
    if (this.isMemcached1_6()) {
      assertNull(this.memcachedClient.get("name"));
      this.memcachedClient.set("name", 1, "dennis", new StringTranscoder(),
          1000);
      assertEquals("dennis", this.memcachedClient.getAndTouch("name", 3));

      Thread.sleep(2000);
      assertEquals("dennis", this.memcachedClient.get("name",
          new StringTranscoder()));
      Thread.sleep(1500);
      assertNull(this.memcachedClient.get("name"));
    }
  }
View Full Code Here

  }

  public void testGet() throws Exception {
    assertNull(memcachedClient.get("name"));

    memcachedClient.set("name", 1, "dennis", new StringTranscoder(), 1000);

    assertEquals("dennis",
        memcachedClient.get("name", new StringTranscoder()));
    new TranscoderChecker(mockTranscoder, 1) {
      @Override
      public void call() throws Exception {
        assertEquals("dennis",
            memcachedClient.get("name", mockTranscoder));
View Full Code Here

  }

  public void testAppendPrepend() throws Exception {
    // append,prepend
    assertTrue(memcachedClient.set("name", 0, "dennis",
        new StringTranscoder(), 1000));
    assertTrue(memcachedClient.prepend("name", "hello "));
    assertEquals("hello dennis", memcachedClient.get("name"));
    assertTrue(memcachedClient.append("name", " zhuang"));
    assertEquals("hello dennis zhuang", memcachedClient.get("name"));
    memcachedClient.delete("name");
View Full Code Here

  public void testSet() throws Exception {
    assertTrue(memcachedClient.set("name", 0, "dennis"));
    assertEquals("dennis", memcachedClient.get("name", 2000));

    assertTrue(memcachedClient.set("name", 1, "zhuang",
        new StringTranscoder()));
    assertEquals("zhuang", memcachedClient.get("name", 2000));
    Thread.sleep(2000);
    // expired
    assertNull(memcachedClient.get("zhuang"));
View Full Code Here

    GetsResponse<String> getsResponse = memcachedClient.gets("name");
    GetsResponse<String> oldGetsResponse = getsResponse;
    assertEquals("dennis", getsResponse.getValue());
    long oldCas = getsResponse.getCas();
    getsResponse = memcachedClient.gets("name", 2000,
        new StringTranscoder());
    assertEquals("dennis", getsResponse.getValue());
    // check the same
    assertEquals(oldCas, getsResponse.getCas());
    assertEquals(oldGetsResponse, getsResponse);
View Full Code Here

    assertTrue(memcachedClient.set(key, 0, 2));
    assertEquals((Integer) 2,
        memcachedClient.get(key, 2000, new IntegerTranscoder()));

    assertTrue(memcachedClient.set(key, 0, "xmemcached",
        new StringTranscoder()));
    assertTrue(memcachedClient.append(key, " great"));
    assertTrue(memcachedClient.prepend(key, "hello "));

    assertEquals("hello xmemcached great", memcachedClient.get(key));
View Full Code Here

  }

  public void testGet() throws Exception {
    assertNull(memcachedClient.get("name"));

    memcachedClient.set("name", 1, "dennis", new StringTranscoder(), 1000);

    assertEquals("dennis", memcachedClient.get("name",
        new StringTranscoder()));
    new TranscoderChecker(mockTranscoder, 1) {
      @Override
      public void call() throws Exception {
        assertEquals("dennis", memcachedClient.get("name",
            mockTranscoder));
View Full Code Here

  }

  public void testAppendPrepend() throws Exception {
    // append,prepend
    assertTrue(memcachedClient.set("name", 0, "dennis",
        new StringTranscoder(), 1000));
    assertTrue(memcachedClient.prepend("name", "hello "));
    assertEquals("hello dennis", memcachedClient.get("name"));
    assertTrue(memcachedClient.append("name", " zhuang"));
    assertEquals("hello dennis zhuang", memcachedClient.get("name"));
    memcachedClient.delete("name");
View Full Code Here

TOP

Related Classes of net.rubyeye.xmemcached.transcoders.StringTranscoder

Copyright © 2018 www.massapicom. 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.