Package net.rubyeye.xmemcached

Examples of net.rubyeye.xmemcached.MemcachedClientBuilder


    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


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

  public Object getObject() throws Exception {
    this.checkAttribute();
    Map<InetSocketAddress, InetSocketAddress> serverMap = this
        .getServerMap();
    int[] weightsArray = this.getWeightsArray(serverMap);
    MemcachedClientBuilder builder = this.newBuilder(serverMap,
        weightsArray);
    this.configBuilder(builder);
    this.memcachedClient = builder.build();
    return this.memcachedClient;
  }
View Full Code Here

  }

  private MemcachedClientBuilder newBuilder(
      Map<InetSocketAddress, InetSocketAddress> serverMap,
      int[] weightsArray) {
    MemcachedClientBuilder builder;
    if (weightsArray == null) {
      builder = new XMemcachedClientBuilder(serverMap);
    } else {
      builder = new XMemcachedClientBuilder(serverMap, weightsArray);
    }
View Full Code Here

  public XmemcachedClientFactory(PropertiesHelper properties) {
    this.properties = properties;
  }

  public Memcache createMemcacheClient() throws Exception {
    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddresses(getServerList()));
    builder.setCommandFactory(getCommandFactory());
    builder.setSessionLocator(getSessionLocator());
    builder.getConfiguration()
        .setSessionReadBufferSize(getReadBufferSize());
    MemcachedClient client = builder.build();
    client.setOpTimeout(getOperationTimeoutMillis());
    return new Xmemcache(client);
  }
View Full Code Here

  public XmemcachedClientFactory(PropertiesHelper properties) {
    this.properties = properties;
  }

  public Memcache createMemcacheClient() throws Exception {
    MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil
        .getAddresses(getServerList()));
    builder.setCommandFactory(getCommandFactory());
    builder.setSessionLocator(getSessionLocator());
    builder.getConfiguration()
        .setSessionReadBufferSize(getReadBufferSize());
    builder.setConnectionPoolSize(getConnectionPoolSize());
    builder.setConnectTimeout(getConnectTimeoutMillis());
    MemcachedClient client = builder.build();
    client.setOpTimeout(getOperationTimeoutMillis());
    return new Xmemcache(client);
  }
View Full Code Here

  MemcachedClient memcachedClient;
  MockMemcachedClientStateListener listener;

  @Override
  protected void setUp() throws Exception {
    MemcachedClientBuilder builder = new XMemcachedClientBuilder();
    listener = new MockMemcachedClientStateListener();
    builder.addStateListener(listener);
    memcachedClient = builder.build();
  }
View Full Code Here

  public Object getObject() throws Exception {
    this.checkAttribute();
    Map<InetSocketAddress, InetSocketAddress> serverMap = this
        .getServerMap();
    int[] weightsArray = this.getWeightsArray(serverMap);
    MemcachedClientBuilder builder = this.newBuilder(serverMap,
        weightsArray);
    this.configBuilder(builder);
    this.memcachedClient = builder.build();
    this.memcachedClient.setOpTimeout(opTimeout);
    return this.memcachedClient;
  }
View Full Code Here

  }

  private MemcachedClientBuilder newBuilder(
      Map<InetSocketAddress, InetSocketAddress> serverMap,
      int[] weightsArray) {
    MemcachedClientBuilder builder;
    if (weightsArray == null) {
      builder = new XMemcachedClientBuilder(serverMap);
    } else {
      builder = new XMemcachedClientBuilder(serverMap, weightsArray);
    }
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.