com.m3.memcached.facade
Class MemcachedClient

java.lang.Object
  extended by com.m3.memcached.facade.MemcachedClient

public class MemcachedClient
extends java.lang.Object

Memcached Client Facade


Field Summary
static java.lang.String DEFAULT_NAMESPACE
          Default namespace
 
Method Summary
 void delete(java.lang.String key)
          Delete key from memcached servers
<T> T
get(java.lang.String key)
          Returns cached value or null
 ClientImpl getClientImpl()
          Returns ClientImpl instance
 void initialize(java.util.List<java.net.InetSocketAddress> addresses)
          Initializes memcached client with default namespace (connecting to the memcached servers and so on.)
 void initialize(java.util.List<java.net.InetSocketAddress> addresses, java.lang.String namespace)
          Initializes memcached client with namespace (connecting to the memcached servers and so on.)
<T> void
set(java.lang.String key, int secondsToExpire, T value)
          Set value to memcached servers
<T> void
setAndEnsure(java.lang.String key, int secondsToExpire, T value)
          Set value to memcached servers and ensure completion
 void shutdown()
          Shutdown client instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAMESPACE

public static final java.lang.String DEFAULT_NAMESPACE
Default namespace

See Also:
Constant Field Values
Method Detail

initialize

public void initialize(java.util.List<java.net.InetSocketAddress> addresses)
                throws java.io.IOException
Initializes memcached client with default namespace (connecting to the memcached servers and so on.)

Parameters:
addresses - server addresses
Throws:
java.io.IOException - when failed initializing

initialize

public void initialize(java.util.List<java.net.InetSocketAddress> addresses,
                       java.lang.String namespace)
                throws java.io.IOException
Initializes memcached client with namespace (connecting to the memcached servers and so on.)

Parameters:
addresses - server addresses
namespace - key namespace
Throws:
java.io.IOException - when failed initializing

get

public <T> T get(java.lang.String key)
      throws java.io.IOException
Returns cached value or null

Type Parameters:
T - value type
Parameters:
key - cache key
Returns:
cached value or null
Throws:
java.io.IOException - when failed accessing servers

set

public <T> void set(java.lang.String key,
                    int secondsToExpire,
                    T value)
         throws java.io.IOException
Set value to memcached servers

Type Parameters:
T - value type
Parameters:
key - cache key
secondsToExpire - seconds to expire
value - value
Throws:
java.io.IOException - when failed accessing servers or putting value

setAndEnsure

public <T> void setAndEnsure(java.lang.String key,
                             int secondsToExpire,
                             T value)
                  throws java.io.IOException
Set value to memcached servers and ensure completion

Type Parameters:
T - value type
Parameters:
key - cache key
secondsToExpire - seconds to expire
value - value
Throws:
java.io.IOException - when failed accessing servers or putting value

delete

public void delete(java.lang.String key)
            throws java.io.IOException
Delete key from memcached servers

Parameters:
key - key
Throws:
java.io.IOException - when failed accessing servers or putting value

shutdown

public void shutdown()
Shutdown client instance.


getClientImpl

public ClientImpl getClientImpl()
Returns ClientImpl instance

Returns:
client implementation


Copyright © 2013. All Rights Reserved.