V - The value type for all operationspublic class DefaultAsciiMemcacheClient<V> extends Object implements AsciiMemcacheClient<V>
AsciiMemcacheClient| Modifier and Type | Field and Description |
|---|---|
private Charset |
charset |
private Metrics |
metrics |
private RawMemcacheClient |
rawMemcacheClient |
private TransformerUtil<V> |
transformerUtil |
private Transcoder<V> |
valueTranscoder |
| Constructor and Description |
|---|
DefaultAsciiMemcacheClient(RawMemcacheClient rawMemcacheClient,
Metrics metrics,
Transcoder<V> valueTranscoder,
Charset charset) |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
add(String key,
V value,
int ttl)
Add a key in memcache with the provided value, with the specified TTL.
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
append(String key,
V value) |
com.google.common.util.concurrent.ListenableFuture<List<GetResult<V>>> |
casGet(List<String> keys)
Get the value for the provided keys
|
com.google.common.util.concurrent.ListenableFuture<GetResult<V>> |
casGet(String key)
Get the value for the provided key, including the CAS value
|
com.google.common.util.concurrent.ListenableFuture<Long> |
decr(String key,
long by)
Decrement a counter for the provided key
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
delete(String key)
Delete the provided key
|
com.google.common.util.concurrent.ListenableFuture<List<V>> |
get(List<String> keys)
Get the value for the provided keys
|
com.google.common.util.concurrent.ListenableFuture<V> |
get(String key)
Get the value for the provided key
|
private com.google.common.util.concurrent.ListenableFuture<GetResult<V>> |
get(String key,
boolean withCas) |
com.google.common.util.concurrent.ListenableFuture<Long> |
incr(String key,
long by)
Increment a counter for the provided key
|
boolean |
isConnected()
Is the client connected to a server?
|
private com.google.common.util.concurrent.ListenableFuture<List<GetResult<V>>> |
multiget(List<String> keys,
boolean withCas) |
int |
numActiveConnections()
How many active socket connections do we have (i.e.
|
int |
numTotalConnections()
How many actual socket connections do we have, including currently disconnected clients.
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
prepend(String key,
V value) |
void |
registerForConnectionChanges(ConnectionChangeListener listener)
Register for connection change events.
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
replace(String key,
V value,
int ttl)
Replace a key in memcache with the provided value, with the specified TTL.
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
set(String key,
V value,
int ttl)
Set a key in memcache to the provided value, with the specified TTL
|
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
set(String key,
V value,
int ttl,
long cas)
Compare and set a key in memcache to the provided value, with the specified TTL
|
void |
shutdown()
Shut down the client.
|
String |
toString() |
com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> |
touch(String key,
int ttl)
Sets the expiration for the provided key
|
void |
unregisterForConnectionChanges(ConnectionChangeListener listener)
Unregister the provided listener so that it no longer receives connection change
callbacks.
|
private final RawMemcacheClient rawMemcacheClient
private final Metrics metrics
private final Transcoder<V> valueTranscoder
private final TransformerUtil<V> transformerUtil
private final Charset charset
public DefaultAsciiMemcacheClient(RawMemcacheClient rawMemcacheClient, Metrics metrics, Transcoder<V> valueTranscoder, Charset charset)
public com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> set(String key, V value, int ttl)
MemcacheClientset in interface MemcacheClient<V>key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondspublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> set(String key, V value, int ttl, long cas)
MemcacheClientset in interface MemcacheClient<V>key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondscas - The CAS value, must match the value on the server for the set to go throughpublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> delete(String key)
MemcacheClientdelete in interface MemcacheClient<V>key - Key, must not be nullpublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> add(String key, V value, int ttl)
MemcacheClientadd in interface MemcacheClient<V>key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondspublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> replace(String key, V value, int ttl)
MemcacheClientreplace in interface MemcacheClient<V>key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondspublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> append(String key, V value)
append in interface MemcacheClient<V>public com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> prepend(String key, V value)
prepend in interface MemcacheClient<V>public com.google.common.util.concurrent.ListenableFuture<Long> incr(String key, long by)
AsciiMemcacheClientincr in interface AsciiMemcacheClient<V>key - The key, must not be nullby - The value to increment the counter bypublic com.google.common.util.concurrent.ListenableFuture<Long> decr(String key, long by)
AsciiMemcacheClientdecr in interface AsciiMemcacheClient<V>key - The key, must not be nullby - The value to decrement the counter bypublic com.google.common.util.concurrent.ListenableFuture<V> get(String key)
MemcacheClientget in interface MemcacheClient<V>key - The key, must not be nullpublic com.google.common.util.concurrent.ListenableFuture<GetResult<V>> casGet(String key)
MemcacheClientcasGet in interface MemcacheClient<V>key - First key, must not be nullprivate com.google.common.util.concurrent.ListenableFuture<GetResult<V>> get(String key, boolean withCas)
public com.google.common.util.concurrent.ListenableFuture<List<V>> get(List<String> keys)
MemcacheClientget in interface MemcacheClient<V>keys - Keys, must not be null, nor must any key in the listpublic com.google.common.util.concurrent.ListenableFuture<List<GetResult<V>>> casGet(List<String> keys)
MemcacheClientcasGet in interface MemcacheClient<V>keys - Keys, must not be null, nor must any key in the listpublic com.google.common.util.concurrent.ListenableFuture<MemcacheStatus> touch(String key, int ttl)
MemcacheClienttouch in interface MemcacheClient<V>key - First key, must not be nullttl - The TTL in secondsprivate com.google.common.util.concurrent.ListenableFuture<List<GetResult<V>>> multiget(List<String> keys, boolean withCas)
public void shutdown()
MemcacheClientshutdown in interface MemcacheClient<V>public void registerForConnectionChanges(ConnectionChangeListener listener)
ObservableClientregisterForConnectionChanges in interface ObservableClientlistener - the listener to notify of connection changespublic void unregisterForConnectionChanges(ConnectionChangeListener listener)
ObservableClientunregisterForConnectionChanges in interface ObservableClientlistener - the listener to unregister.public boolean isConnected()
ObservableClientisConnected in interface ObservableClientpublic int numTotalConnections()
MemcacheClientnumTotalConnections in interface MemcacheClient<V>public int numActiveConnections()
MemcacheClientnumActiveConnections in interface MemcacheClient<V>Copyright © 2017 Spotify AB. All Rights Reserved.