Package com.meetup.memcached

Examples of com.meetup.memcached.SockIOPool


  public MemcachedClient getClient() {
    return client;
  }

  public Memcache(final List<String> servers, final String poolName) {
    SockIOPool pool = SockIOPool.getInstance(poolName);
    this.poolName = poolName;
    String[] serv = new String[servers.size()];
    for (int i = 0; i < serv.length; i++) {
      serv[i] = servers.get(i);
    }
    pool.setServers(serv);
    // pool.setNagle(false);
    pool.setInitConn(5);
    pool.setMinConn(5);
    // default to 6 hours
    pool.setMaxIdle(1000 * 60 * 60 * 6);
    pool.setHashingAlg(SockIOPool.NEW_COMPAT_HASH);
    pool.setFailover(true);

    pool.initialize();
    client = new MemcachedClient(poolName);
    client.setPrimitiveAsString(false);
    client.setCompressEnable(true);
    client.setSanitizeKeys(true);
    Logger.getLogger(MemcachedClient.class.getName()).setLevel(Logger.LEVEL_WARN);
View Full Code Here


  public void setPoolName(final String poolName) {
    this.poolName = poolName;
  }

  public void disconnect() {
    SockIOPool pool = SockIOPool.getInstance(getPoolName());
    if (pool != null && pool.isInitialized()) {
      SockIOPool.getInstance(getPoolName()).shutDown();
    }
  }
View Full Code Here

        if ( args.length > 0 )
            serverlist = args;

        // initialize the pool for memcache servers
        SockIOPool pool = SockIOPool.getInstance( "test" );
        try {
          pool.setServers( serverlist );
          pool.setWeights( weights );
          pool.setMaxConn( 250 );
          pool.setNagle( false );
          pool.setHashingAlg( SockIOPool.CONSISTENT_HASH );
          pool.initialize();

          mc = new MemcachedClient( "test" );
          mc.flushAll();
          runAlTests( mc );
        } finally {
          pool.shutDown();
        }
        log.warn("Finished: " + ((System.currentTimeMillis() - time)/1000) + "s");
    }
View Full Code Here

            return;
        }
        String[] serverlist = servers.split(",\\s*");

        // initialize the pool for memcache servers
        SockIOPool pool = SockIOPool.getInstance();
        pool.setServers(serverlist);

        pool.setInitConn(ERXProperties.intForKeyWithDefault("er.caching.initialConnections", 5));
        pool.setMinConn(ERXProperties.intForKeyWithDefault("er.caching.minConnections", 5));
        pool.setMaxConn(ERXProperties.intForKeyWithDefault("er.caching.maxConnections", 50));
        pool.setMaintSleep(ERXProperties.intForKeyWithDefault("er.caching.sleepTime", 30));

        pool.setNagle(ERXProperties.booleanForKeyWithDefault("er.caching.useNagle", false));
        pool.initialize();
  }
View Full Code Here

TOP

Related Classes of com.meetup.memcached.SockIOPool

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.