Package net.rubyeye.xmemcached

Examples of net.rubyeye.xmemcached.MemcachedClientBuilder


public class StandardHashMemcachedClientTest extends XMemcachedClientTest {

  @Override
  public MemcachedClientBuilder createBuilder() throws Exception {
    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddresses(this.properties
            .getProperty("test.memcached.servers")));
    //builder.setConnectionPoolSize(Runtime.getRuntime().availableProcessors());
    return builder;
  }
View Full Code Here


    int[] weights = new int[addressList.size()];
    for (int i = 0; i < weights.length; i++) {
      weights[i] = i + 1;
    }

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(
        addressList, weights);
    builder.setSessionLocator(new KetamaMemcachedSessionLocator());
    return builder;
  }
View Full Code Here

  @Override
  public void setUp() throws Exception {
    this.properties = ResourcesUtils
        .getResourceAsProperties("test.properties");
    MemcachedClientBuilder builder = newBuilder();
    builder.setConnectionPoolSize(5);
    //builder.getConfiguration().setSessionIdleTimeout(5);
    this.memcachedClient = builder.build();
    this.memcachedClient.flushAll();
  }
View Full Code Here

    this.memcachedClient = builder.build();
    this.memcachedClient.flushAll();
  }

  private MemcachedClientBuilder newBuilder() {
    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddresses(this.properties
            .getProperty("test.kestrel.servers")));
    // Use kestrel command factory
    builder.setCommandFactory(new KestrelCommandFactory());
    return builder;
  }
View Full Code Here

        .getProperty("test.memcached.servers"));
    int[] weights = new int[addressList.size()];
    for (int i = 0; i < weights.length; i++) {
      weights[i] = i + 1;
    }
    MemcachedClientBuilder builder = new XMemcachedClientBuilder(
        addressList, weights);
    builder.setSessionLocator(new KetamaMemcachedSessionLocator());
    return builder;
  }
View Full Code Here

*/
public class BinaryMemcachedClientUnitTest extends XMemcachedClientTest {
  @Override
  public MemcachedClientBuilder createBuilder() throws Exception {

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddresses(this.properties
            .getProperty("test.memcached.servers")));
    builder.setCommandFactory(new BinaryCommandFactory());
    ByteUtils.testing = true;
    return builder;
  }
View Full Code Here

    int[] weights = new int[addressList.size()];
    for (int i = 0; i < weights.length; i++) {
      weights[i] = i + 1;
    }

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(
        addressList, weights);
    builder.setCommandFactory(new BinaryCommandFactory());
    builder.setSessionLocator(new KetamaMemcachedSessionLocator());
    ByteUtils.testing = true;
    return builder;
  }
View Full Code Here

    TCPController memServer2 = new TCPController();
    memServer2.setHandler(new MockHandler("response from server2"));
    memServer2.setCodecFactory(new TextLineCodecFactory());
    memServer2.bind(new InetSocketAddress(4798));

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddressMap("localhost:4799,localhost:4798"));
    // It must be in failure mode
    builder.setFailureMode(true);
    MemcachedClient client = builder.build();

    client.setEnableHeartBeat(false);

    try {
View Full Code Here

    TCPController memServer2 = new TCPController();
    memServer2.setHandler(new MockHandler("response from server2"));
    memServer2.setCodecFactory(new TextLineCodecFactory());
    memServer2.bind(new InetSocketAddress(4798));

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddressMap("localhost:4799 localhost:4798"));
    // It must be in failure mode
    builder.setFailureMode(true);
    MemcachedClient client = builder.build();

    client.setEnableHeartBeat(false);
    TCPController memServer1 = null;
    try {
View Full Code Here

    TCPController memServer2 = new TCPController();
    memServer2.setHandler(new MockHandler("response from server2"));
    memServer2.setCodecFactory(new TextLineCodecFactory());
    memServer2.bind(new InetSocketAddress(4798));

    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddressMap("localhost:4799,localhost:4798"));
    // It must be in failure mode
    builder.setFailureMode(true);
    MemcachedClient client = builder.build();

    client.setEnableHeartBeat(false);

    try {
      assertEquals("response from server1", client.get("a"));
View Full Code Here

TOP

Related Classes of net.rubyeye.xmemcached.MemcachedClientBuilder

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.