net.spy.memcached.BinaryConnectionFactory Java Examples

The following examples show how to use net.spy.memcached.BinaryConnectionFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheHelper.java    From open-rmbt with Apache License 2.0 6 votes vote down vote up
public void initMemcached(String addresses) // addresses: space sep. like 'localhost:11211 10.10.10.10:1234'
{
    if (memcachedClient.get() != null)
        throw new IllegalStateException("memcached already initialized");
    try
    {
        final MemcachedClient _memcachedClient = new MemcachedClient(
                new BinaryConnectionFactory(),
                AddrUtil.getAddresses(addresses));
        _memcachedClient.addObserver(this);
        memcachedClient.set(_memcachedClient);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
Example #2
Source File: GemcachedBinaryClientJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
@Override
protected MemcachedClient createMemcachedClient() throws IOException,
    UnknownHostException {
  List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
  addrs.add(new InetSocketAddress(SocketCreator.getLocalHost(), PORT));
  MemcachedClient client = new MemcachedClient(new BinaryConnectionFactory(), addrs);
  return client;
}
 
Example #3
Source File: GemcachedBinaryClientJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
@Override
protected MemcachedClient createMemcachedClient() throws IOException,
    UnknownHostException {
  List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
  addrs.add(new InetSocketAddress(SocketCreator.getLocalHost(), PORT));
  MemcachedClient client = new MemcachedClient(new BinaryConnectionFactory(), addrs);
  return client;
}
 
Example #4
Source File: ClientMemcachedProtocolSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @return Memcache client.
 * @throws Exception If start failed.
 */
private MemcachedClientIF startClient() throws Exception {
    int port = customPort != null ? customPort : IgniteConfiguration.DFLT_TCP_PORT;

    return new MemcachedClient(new BinaryConnectionFactory(),
        F.asList(new InetSocketAddress(LOC_HOST, port)));
}
 
Example #5
Source File: BaseConnectionFactory.java    From EVCache with Apache License 2.0 5 votes vote down vote up
BaseConnectionFactory(EVCacheClient client, int len, Property<Integer> _operationTimeout, long opMaxBlockTime) {
    super(len, BinaryConnectionFactory.DEFAULT_READ_BUFFER_SIZE, DefaultHashAlgorithm.KETAMA_HASH);
    this.opMaxBlockTime = opMaxBlockTime;
    this.operationTimeout = _operationTimeout;
    this.client = client;
    this.startTime = System.currentTimeMillis();

    this.appName = client.getAppName();
    this.failureMode = client.getPool().getEVCacheClientPoolManager().getEVCacheConfig().getPropertyRepository().get(this.client.getServerGroupName() + ".failure.mode", String.class).orElseGet(appName + ".failure.mode").orElse("Retry");
    this.name = appName + "-" + client.getServerGroupName() + "-" + client.getId();
}
 
Example #6
Source File: SessionStorageMemcachedImpl.java    From openbd-core with GNU General Public License v3.0 3 votes vote down vote up
public SessionStorageMemcachedImpl(String appName, String _connectionUri) throws Exception {
	super(appName);
	
	this.uri = _connectionUri;
	
	// Are they using a user/pass
	String connectionUri	= _connectionUri.substring( _connectionUri.indexOf("//")+2 );

	memcache	= new MemcachedClient( new BinaryConnectionFactory(), AddrUtil.getAddresses(connectionUri) );
	
	cfEngine.log( "SessionStorageMemcached: Created " + _connectionUri );
}