com.schooner.MemCached
Class AscIIUDPClient

java.lang.Object
  extended by com.whalin.MemCached.MemCachedClient
      extended by com.schooner.MemCached.AscIIUDPClient

public class AscIIUDPClient
extends MemCachedClient

This client implements the UDP protocol of memcached in a very high performance way.

Please use the wrapper class MemCachedClient for accessing the memcached server.

When you are using memcached UDP protocol, pay attention that the data size limit is about 64K due to the datagram length limit of UDP protocol.

A UDP datagram length field specifies the length in bytes of the entire datagram: header and data. The minimum length is 8 bytes since that's the length of the header. The field size sets a theoretical limit of 65,535 bytes (8 byte header + 65,527 bytes of data) for a UDP datagram. The practical limit for the data length which is imposed by the underlying IPv4 protocol is 65,507 bytes (65,535 − 8 byte UDP header − 20 byte IP header).

Since:
2.5.0
Author:
Xingen Wang
See Also:
BinaryClient

Field Summary
static byte B_DELIMITER
           
static byte B_RETURN
           
 
Fields inherited from class com.whalin.MemCached.MemCachedClient
AUTH_FAILED, B_DELETED, B_END, B_NOTFOUND, B_STORED, BLAND_DATA_SIZE, classLoader, CLIENT_ERROR, COMPRESS_THRESH, DELETED, END, ERROR, errorHandler, F_COMPRESSED, F_SERIALIZED, FURTHER_AUTH, ITEM, log, MAGIC_REQ, MAGIC_RESP, MARKER_BOOLEAN, MARKER_BYTE, MARKER_BYTEARR, MARKER_CHARACTER, MARKER_DATE, MARKER_DOUBLE, MARKER_FLOAT, MARKER_INTEGER, MARKER_LONG, MARKER_OTHERS, MARKER_SHORT, MARKER_STRING, MARKER_STRINGBUFFER, MARKER_STRINGBUILDER, NOTFOUND, OK, OPCODE_ADD, OPCODE_APPEND, OPCODE_AUTH_LIST, OPCODE_AUTH_STEPS, OPCODE_DECREMENT, OPCODE_DELETE, OPCODE_FLUSH, OPCODE_GET, OPCODE_GETK, OPCODE_GETKQ, OPCODE_GETQ, OPCODE_INCREMENT, OPCODE_NOOP, OPCODE_PREPEND, OPCODE_QUIT, OPCODE_REPLACE, OPCODE_SET, OPCODE_START_AUTH, OPCODE_STAT, OPCODE_VERSION, SERVER_ERROR, STAT_INVALID_ARGUMENTS, STAT_ITEM_NOT_STORED, STAT_KEY_EXISTS, STAT_KEY_NOT_FOUND, STAT_NO_ERROR, STAT_OUT_OF_MEMORY, STAT_UNKNOWN_COMMAND, STAT_VALUE_TOO_BIG, STATS, STORED, SYNCED, VALUE
 
Constructor Summary
AscIIUDPClient()
          Creates a new instance of MemCachedClient.
AscIIUDPClient(String poolName)
          Creates a new instance of MemCachedClient accepting a passed in pool name.
AscIIUDPClient(String poolName, ClassLoader cl, ErrorHandler eh)
           
 
Method Summary
 boolean add(String key, Object value)
          Adds data to the server; only the key and the value are specified.
 boolean add(String key, Object value, Date expiry)
          Adds data to the server; the key, value, and an expiration time are specified.
 boolean add(String key, Object value, Date expiry, Integer hashCode)
          Adds data to the server; the key, value, and an expiration time are specified.
 boolean add(String key, Object value, Integer hashCode)
          Adds data to the server; the key, value, and an optional hashcode are passed in.
 long addOrDecr(String key)
          Thread safe way to initialize and decrement a counter.
 long addOrDecr(String key, long inc)
          Thread safe way to initialize and decrement a counter.
 long addOrDecr(String key, long inc, Integer hashCode)
          Thread safe way to initialize and decrement a counter.
 long addOrIncr(String key)
          Thread safe way to initialize and increment a counter.
 long addOrIncr(String key, long inc)
          Thread safe way to initialize and increment a counter.
 long addOrIncr(String key, long inc, Integer hashCode)
          Thread safe way to initialize and increment a counter.
 boolean append(String key, Object value)
           
 boolean append(String key, Object value, Integer hashCode)
           
 boolean cas(String key, Object value, Date expiry, Integer hashCode, long casUnique)
           
 boolean cas(String key, Object value, Date expiry, long casUnique)
           
 boolean cas(String key, Object value, Integer hashCode, long casUnique)
           
 boolean cas(String key, Object value, long casUnique)
           
 long decr(String key)
          Decrement the value at the specified key by 1, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 long decr(String key, long inc)
          Decrement the value at the specified key by passed in value, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 long decr(String key, long inc, Integer hashCode)
          Decrement the value at the specified key by the specified increment, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 boolean delete(String key)
          Deletes an object from cache given cache key.
 boolean delete(String key, Date expiry)
          Deletes an object from cache given cache key and expiration date.
 boolean delete(String key, Integer hashCode, Date expiry)
          Deletes an object from cache given cache key, a delete time, and an optional hashcode.
 boolean flushAll()
          Invalidates the entire cache.
 boolean flushAll(String[] servers)
          Invalidates the entire cache.
 Object get(String key)
          Retrieve a key from the server, using a specific hash.
 Object get(String key, Integer hashCode)
          Retrieve a key from the server, using a specific hash.
 Object get(String key, Integer hashCode, boolean asString)
          Retrieve a key from the server, using a specific hash.
 Map<String,Object> getMulti(String[] keys)
          Retrieve multiple objects from the memcache.
 Map<String,Object> getMulti(String[] keys, Integer[] hashCodes)
          Retrieve multiple keys from the memcache.
 Map<String,Object> getMulti(String[] keys, Integer[] hashCodes, boolean asString)
          Retrieve multiple keys from the memcache.
 Object[] getMultiArray(String[] keys)
          Retrieve multiple objects from the memcache.
 Object[] getMultiArray(String[] keys, Integer[] hashCodes)
          Retrieve multiple objects from the memcache.
 Object[] getMultiArray(String[] keys, Integer[] hashCodes, boolean asString)
          Retrieve multiple objects from the memcache.
 MemcachedItem gets(String key)
           
 MemcachedItem gets(String key, Integer hashCode)
           
 long incr(String key)
          Increment the value at the specified key by 1, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 long incr(String key, long inc)
          Increment the value at the specified key by passed in val.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 long incr(String key, long inc, Integer hashCode)
          Increment the value at the specified key by the specified increment, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.
 boolean isUseBinaryProtocol()
           
 boolean keyExists(String key)
          Checks to see if key exists in cache.
 boolean prepend(String key, Object value)
           
 boolean prepend(String key, Object value, Integer hashCode)
           
 boolean replace(String key, Object value)
          Updates data on the server; only the key and the value are specified.
 boolean replace(String key, Object value, Date expiry)
          Updates data on the server; the key, value, and an expiration time are specified.
 boolean replace(String key, Object value, Date expiry, Integer hashCode)
          Updates data on the server; the key, value, and an expiration time are specified.
 boolean replace(String key, Object value, Integer hashCode)
          Updates data on the server; only the key and the value and an optional hash are specified.
 boolean set(String key, Object value)
          Stores data on the server; only the key and the value are specified.
 boolean set(String key, Object value, Date expiry)
          Stores data on the server; the key, value, and an expiration time are specified.
 boolean set(String key, Object value, Date expiry, Integer hashCode)
          Stores data on the server; the key, value, and an expiration time are specified.
 boolean set(String key, Object value, Integer hashCode)
          Stores data on the server; only the key and the value are specified.
 void setDefaultEncoding(String defaultEncoding)
          Sets default String encoding when storing primitives as Strings.
 void setPrimitiveAsString(boolean primitiveAsString)
          Enables storing primitive types as their String values.
 void setSanitizeKeys(boolean sanitizeKeys)
          Enables/disables sanitizing keys by URLEncoding.
 void setTransCoder(TransCoder transCoder)
          set transcoder.
 Map<String,Map<String,String>> stats()
          Retrieves stats for all servers.
 Map<String,Map<String,String>> stats(String[] servers)
          Retrieves stats for passed in servers (or all servers).
 Map<String,Map<String,String>> statsCacheDump(int slabNumber, int limit)
          Retrieves items cachedump for all servers.
 Map<String,Map<String,String>> statsCacheDump(String[] servers, int slabNumber, int limit)
          Retrieves stats for passed in servers (or all servers).
 Map<String,Map<String,String>> statsItems()
          Retrieves stats items for all servers.
 Map<String,Map<String,String>> statsItems(String[] servers)
          Retrieves stats for passed in servers (or all servers).
 Map<String,Map<String,String>> statsSlabs()
          Retrieves stats items for all servers.
 Map<String,Map<String,String>> statsSlabs(String[] servers)
          Retrieves stats for passed in servers (or all servers).
 boolean sync(String key)
           
 boolean sync(String key, Integer hashCode)
           
 boolean syncAll()
           
 boolean syncAll(String[] servers)
           
 
Methods inherited from class com.whalin.MemCached.MemCachedClient
getCounter, getCounter, setClassLoader, setCompressEnable, setCompressThreshold, setErrorHandler, storeCounter, storeCounter, storeCounter, storeCounter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

B_DELIMITER

public static final byte B_DELIMITER
See Also:
Constant Field Values

B_RETURN

public static final byte B_RETURN
See Also:
Constant Field Values
Constructor Detail

AscIIUDPClient

public AscIIUDPClient()
Creates a new instance of MemCachedClient.


AscIIUDPClient

public AscIIUDPClient(String poolName)
Creates a new instance of MemCachedClient accepting a passed in pool name.

Parameters:
poolName - name of SockIOPool
binaryProtocal - whether use binary protocol.

AscIIUDPClient

public AscIIUDPClient(String poolName,
                      ClassLoader cl,
                      ErrorHandler eh)
Method Detail

isUseBinaryProtocol

public boolean isUseBinaryProtocol()
Overrides:
isUseBinaryProtocol in class MemCachedClient

set

public boolean set(String key,
                   Object value)
Description copied from class: MemCachedClient
Stores data on the server; only the key and the value are specified.

Overrides:
set in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
Returns:
true, if the data was successfully stored

set

public boolean set(String key,
                   Object value,
                   Integer hashCode)
Description copied from class: MemCachedClient
Stores data on the server; only the key and the value are specified.

Overrides:
set in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

set

public boolean set(String key,
                   Object value,
                   Date expiry)
Description copied from class: MemCachedClient
Stores data on the server; the key, value, and an expiration time are specified.

Overrides:
set in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
Returns:
true, if the data was successfully stored

set

public boolean set(String key,
                   Object value,
                   Date expiry,
                   Integer hashCode)
Description copied from class: MemCachedClient
Stores data on the server; the key, value, and an expiration time are specified.

Overrides:
set in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

add

public boolean add(String key,
                   Object value)
Description copied from class: MemCachedClient
Adds data to the server; only the key and the value are specified.

Overrides:
add in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
Returns:
true, if the data was successfully stored

add

public boolean add(String key,
                   Object value,
                   Integer hashCode)
Description copied from class: MemCachedClient
Adds data to the server; the key, value, and an optional hashcode are passed in.

Overrides:
add in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

add

public boolean add(String key,
                   Object value,
                   Date expiry)
Description copied from class: MemCachedClient
Adds data to the server; the key, value, and an expiration time are specified.

Overrides:
add in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
Returns:
true, if the data was successfully stored

add

public boolean add(String key,
                   Object value,
                   Date expiry,
                   Integer hashCode)
Description copied from class: MemCachedClient
Adds data to the server; the key, value, and an expiration time are specified.

Overrides:
add in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

append

public boolean append(String key,
                      Object value,
                      Integer hashCode)
Overrides:
append in class MemCachedClient

append

public boolean append(String key,
                      Object value)
Overrides:
append in class MemCachedClient

cas

public boolean cas(String key,
                   Object value,
                   Integer hashCode,
                   long casUnique)
Overrides:
cas in class MemCachedClient

cas

public boolean cas(String key,
                   Object value,
                   Date expiry,
                   long casUnique)
Overrides:
cas in class MemCachedClient

cas

public boolean cas(String key,
                   Object value,
                   Date expiry,
                   Integer hashCode,
                   long casUnique)
Overrides:
cas in class MemCachedClient

cas

public boolean cas(String key,
                   Object value,
                   long casUnique)
Overrides:
cas in class MemCachedClient

prepend

public boolean prepend(String key,
                       Object value,
                       Integer hashCode)
Overrides:
prepend in class MemCachedClient

prepend

public boolean prepend(String key,
                       Object value)
Overrides:
prepend in class MemCachedClient

replace

public boolean replace(String key,
                       Object value)
Description copied from class: MemCachedClient
Updates data on the server; only the key and the value are specified.

Overrides:
replace in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
Returns:
true, if the data was successfully stored

replace

public boolean replace(String key,
                       Object value,
                       Integer hashCode)
Description copied from class: MemCachedClient
Updates data on the server; only the key and the value and an optional hash are specified.

Overrides:
replace in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

replace

public boolean replace(String key,
                       Object value,
                       Date expiry)
Description copied from class: MemCachedClient
Updates data on the server; the key, value, and an expiration time are specified.

Overrides:
replace in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
Returns:
true, if the data was successfully stored

replace

public boolean replace(String key,
                       Object value,
                       Date expiry,
                       Integer hashCode)
Description copied from class: MemCachedClient
Updates data on the server; the key, value, and an expiration time are specified.

Overrides:
replace in class MemCachedClient
Parameters:
key - key to store data under
value - value to store
expiry - when to expire the record
hashCode - if not null, then the int hashcode to use
Returns:
true, if the data was successfully stored

setTransCoder

public void setTransCoder(TransCoder transCoder)
set transcoder. TransCoder is used to customize the serialization and deserialization.

Overrides:
setTransCoder in class MemCachedClient
Parameters:
transCoder -

addOrDecr

public long addOrDecr(String key)
Description copied from class: MemCachedClient
Thread safe way to initialize and decrement a counter.

Overrides:
addOrDecr in class MemCachedClient
Parameters:
key - key where the data is stored
Returns:
value of incrementer

addOrDecr

public long addOrDecr(String key,
                      long inc)
Description copied from class: MemCachedClient
Thread safe way to initialize and decrement a counter.

Overrides:
addOrDecr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - value to set or increment by
Returns:
value of incrementer

addOrDecr

public long addOrDecr(String key,
                      long inc,
                      Integer hashCode)
Description copied from class: MemCachedClient
Thread safe way to initialize and decrement a counter.

Overrides:
addOrDecr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - value to set or increment by
hashCode - if not null, then the int hashcode to use
Returns:
value of incrementer

addOrIncr

public long addOrIncr(String key)
Description copied from class: MemCachedClient
Thread safe way to initialize and increment a counter.

Overrides:
addOrIncr in class MemCachedClient
Parameters:
key - key where the data is stored
Returns:
value of incrementer

addOrIncr

public long addOrIncr(String key,
                      long inc)
Description copied from class: MemCachedClient
Thread safe way to initialize and increment a counter.

Overrides:
addOrIncr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - value to set or increment by
Returns:
value of incrementer

addOrIncr

public long addOrIncr(String key,
                      long inc,
                      Integer hashCode)
Description copied from class: MemCachedClient
Thread safe way to initialize and increment a counter.

Overrides:
addOrIncr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - value to set or increment by
hashCode - if not null, then the int hashcode to use
Returns:
value of incrementer

decr

public long decr(String key)
Description copied from class: MemCachedClient
Decrement the value at the specified key by 1, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
decr in class MemCachedClient
Parameters:
key - key where the data is stored
Returns:
-1, if the key is not found, the value after incrementing otherwise

decr

public long decr(String key,
                 long inc)
Description copied from class: MemCachedClient
Decrement the value at the specified key by passed in value, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
decr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - how much to increment by
Returns:
-1, if the key is not found, the value after incrementing otherwise

decr

public long decr(String key,
                 long inc,
                 Integer hashCode)
Description copied from class: MemCachedClient
Decrement the value at the specified key by the specified increment, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
decr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - how much to increment by
hashCode - if not null, then the int hashcode to use
Returns:
-1, if the key is not found, the value after incrementing otherwise

delete

public boolean delete(String key)
Description copied from class: MemCachedClient
Deletes an object from cache given cache key.

Overrides:
delete in class MemCachedClient
Parameters:
key - the key to be removed
Returns:
true, if the data was deleted successfully

delete

public boolean delete(String key,
                      Date expiry)
Description copied from class: MemCachedClient
Deletes an object from cache given cache key and expiration date.

Overrides:
delete in class MemCachedClient
Parameters:
key - the key to be removed
expiry - when to expire the record.
Returns:
true, if the data was deleted successfully

flushAll

public boolean flushAll()
Description copied from class: MemCachedClient
Invalidates the entire cache. Will return true only if succeeds in clearing all servers.

Overrides:
flushAll in class MemCachedClient
Returns:
success true/false

flushAll

public boolean flushAll(String[] servers)
Description copied from class: MemCachedClient
Invalidates the entire cache. Will return true only if succeeds in clearing all servers. If pass in null, then will try to flush all servers.

Overrides:
flushAll in class MemCachedClient
Parameters:
servers - optional array of host(s) to flush (host:port)
Returns:
success true/false

get

public Object get(String key)
Description copied from class: MemCachedClient
Retrieve a key from the server, using a specific hash. If the data was compressed or serialized when compressed, it will automatically
be decompressed or serialized, as appropriate. (Inclusive or)

Non-serialized data will be returned as a string, so explicit conversion to
numeric types will be necessary, if desired

Overrides:
get in class MemCachedClient
Parameters:
key - key where data is stored
Returns:
the object that was previously stored, or null if it was not previously stored

get

public Object get(String key,
                  Integer hashCode)
Description copied from class: MemCachedClient
Retrieve a key from the server, using a specific hash. If the data was compressed or serialized when compressed, it will automatically
be decompressed or serialized, as appropriate. (Inclusive or)

Non-serialized data will be returned as a string, so explicit conversion to
numeric types will be necessary, if desired

Overrides:
get in class MemCachedClient
Parameters:
key - key where data is stored
hashCode - if not null, then the int hashcode to use
Returns:
the object that was previously stored, or null if it was not previously stored

getMulti

public Map<String,Object> getMulti(String[] keys)
Description copied from class: MemCachedClient
Retrieve multiple objects from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMulti in class MemCachedClient
Parameters:
keys - String array of keys to retrieve
Returns:
a hashmap with entries for each key is found by the server, keys that are not found are not entered into the hashmap, but attempting to retrieve them from the hashmap gives you null.

getMulti

public Map<String,Object> getMulti(String[] keys,
                                   Integer[] hashCodes)
Description copied from class: MemCachedClient
Retrieve multiple keys from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMulti in class MemCachedClient
Parameters:
keys - keys to retrieve
hashCodes - if not null, then the Integer array of hashCodes
Returns:
a hashmap with entries for each key is found by the server, keys that are not found are not entered into the hashmap, but attempting to retrieve them from the hashmap gives you null.

getMultiArray

public Object[] getMultiArray(String[] keys)
Description copied from class: MemCachedClient
Retrieve multiple objects from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMultiArray in class MemCachedClient
Parameters:
keys - String array of keys to retrieve
Returns:
Object array ordered in same order as key array containing results

getMultiArray

public Object[] getMultiArray(String[] keys,
                              Integer[] hashCodes)
Description copied from class: MemCachedClient
Retrieve multiple objects from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMultiArray in class MemCachedClient
Parameters:
keys - String array of keys to retrieve
hashCodes - if not null, then the Integer array of hashCodes
Returns:
Object array ordered in same order as key array containing results

getMultiArray

public Object[] getMultiArray(String[] keys,
                              Integer[] hashCodes,
                              boolean asString)
Retrieve multiple objects from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMultiArray in class MemCachedClient
Parameters:
keys - String array of keys to retrieve
hashCodes - if not null, then the Integer array of hashCodes
asString - if true, retrieve string vals
Returns:
Object array ordered in same order as key array containing results

gets

public MemcachedItem gets(String key)
Overrides:
gets in class MemCachedClient

gets

public MemcachedItem gets(String key,
                          Integer hashCode)
Overrides:
gets in class MemCachedClient

incr

public long incr(String key)
Description copied from class: MemCachedClient
Increment the value at the specified key by 1, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
incr in class MemCachedClient
Parameters:
key - key where the data is stored
Returns:
-1, if the key is not found, the value after incrementing otherwise

incr

public long incr(String key,
                 long inc)
Description copied from class: MemCachedClient
Increment the value at the specified key by passed in val.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
incr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - how much to increment by
Returns:
-1, if the key is not found, the value after incrementing otherwise

incr

public long incr(String key,
                 long inc,
                 Integer hashCode)
Description copied from class: MemCachedClient
Increment the value at the specified key by the specified increment, and then return it.
Please make sure setPrimitiveAsString=true if the key/value pair is stored with set command.

Overrides:
incr in class MemCachedClient
Parameters:
key - key where the data is stored
inc - how much to increment by
hashCode - if not null, then the int hashcode to use
Returns:
-1, if the key is not found, the value after incrementing otherwise

keyExists

public boolean keyExists(String key)
Description copied from class: MemCachedClient
Checks to see if key exists in cache.

Overrides:
keyExists in class MemCachedClient
Parameters:
key - the key to look for
Returns:
true if key found in cache, false if not (or if cache is down)

stats

public Map<String,Map<String,String>> stats()
Description copied from class: MemCachedClient
Retrieves stats for all servers. Returns a map keyed on the servername. The value is another map which contains stats with stat name as key and value as value.

Overrides:
stats in class MemCachedClient
Returns:
Stats map

stats

public Map<String,Map<String,String>> stats(String[] servers)
Description copied from class: MemCachedClient
Retrieves stats for passed in servers (or all servers). Returns a map keyed on the servername. The value is another map which contains stats with stat name as key and value as value.

Overrides:
stats in class MemCachedClient
Parameters:
servers - string array of servers to retrieve stats from, or all if this is null
Returns:
Stats map

statsCacheDump

public Map<String,Map<String,String>> statsCacheDump(int slabNumber,
                                                     int limit)
Description copied from class: MemCachedClient
Retrieves items cachedump for all servers. Returns a map keyed on the servername. The value is another map which contains cachedump stats with the cachekey as key and byte size and unix timestamp as value.

Overrides:
statsCacheDump in class MemCachedClient
Parameters:
slabNumber - the item number of the cache dump
Returns:
Stats map

statsCacheDump

public Map<String,Map<String,String>> statsCacheDump(String[] servers,
                                                     int slabNumber,
                                                     int limit)
Description copied from class: MemCachedClient
Retrieves stats for passed in servers (or all servers). Returns a map keyed on the servername. The value is another map which contains cachedump stats with the cachekey as key and byte size and unix timestamp as value.

Overrides:
statsCacheDump in class MemCachedClient
Parameters:
servers - string array of servers to retrieve stats from, or all if this is null
slabNumber - the item number of the cache dump
Returns:
Stats map

statsItems

public Map<String,Map<String,String>> statsItems()
Description copied from class: MemCachedClient
Retrieves stats items for all servers. Returns a map keyed on the servername. The value is another map which contains item stats with itemname:number:field as key and value as value.

Overrides:
statsItems in class MemCachedClient
Returns:
Stats map

statsItems

public Map<String,Map<String,String>> statsItems(String[] servers)
Description copied from class: MemCachedClient
Retrieves stats for passed in servers (or all servers). Returns a map keyed on the servername. The value is another map which contains item stats with itemname:number:field as key and value as value.

Overrides:
statsItems in class MemCachedClient
Parameters:
servers - string array of servers to retrieve stats from, or all if this is null
Returns:
Stats map

statsSlabs

public Map<String,Map<String,String>> statsSlabs()
Description copied from class: MemCachedClient
Retrieves stats items for all servers. Returns a map keyed on the servername. The value is another map which contains slabs stats with slabnumber:field as key and value as value.

Overrides:
statsSlabs in class MemCachedClient
Returns:
Stats map

statsSlabs

public Map<String,Map<String,String>> statsSlabs(String[] servers)
Description copied from class: MemCachedClient
Retrieves stats for passed in servers (or all servers). Returns a map keyed on the servername. The value is another map which contains slabs stats with slabnumber:field as key and value as value.

Overrides:
statsSlabs in class MemCachedClient
Parameters:
servers - string array of servers to retrieve stats from, or all if this is null
Returns:
Stats map

sync

public boolean sync(String key,
                    Integer hashCode)
Overrides:
sync in class MemCachedClient

sync

public boolean sync(String key)
Overrides:
sync in class MemCachedClient

syncAll

public boolean syncAll()
Overrides:
syncAll in class MemCachedClient

syncAll

public boolean syncAll(String[] servers)
Overrides:
syncAll in class MemCachedClient

delete

public boolean delete(String key,
                      Integer hashCode,
                      Date expiry)
Description copied from class: MemCachedClient
Deletes an object from cache given cache key, a delete time, and an optional hashcode. The item is immediately made non retrievable.
Keep in mind add and replace
will fail when used with the same key will fail, until the server reaches the
specified time. However, set will succeed,
and the new value will not be deleted.

Overrides:
delete in class MemCachedClient
Parameters:
key - the key to be removed
hashCode - if not null, then the int hashcode to use
expiry - when to expire the record.
Returns:
true, if the data was deleted successfully

setDefaultEncoding

public void setDefaultEncoding(String defaultEncoding)
Description copied from class: MemCachedClient
Sets default String encoding when storing primitives as Strings. Default is UTF-8.

Overrides:
setDefaultEncoding in class MemCachedClient

setPrimitiveAsString

public void setPrimitiveAsString(boolean primitiveAsString)
Description copied from class: MemCachedClient
Enables storing primitive types as their String values.

Overrides:
setPrimitiveAsString in class MemCachedClient
Parameters:
primitiveAsString - if true, then store all primitives as their string value.

setSanitizeKeys

public void setSanitizeKeys(boolean sanitizeKeys)
Description copied from class: MemCachedClient
Enables/disables sanitizing keys by URLEncoding.

Overrides:
setSanitizeKeys in class MemCachedClient
Parameters:
sanitizeKeys - if true, then URLEncode all keys

get

public Object get(String key,
                  Integer hashCode,
                  boolean asString)
Description copied from class: MemCachedClient
Retrieve a key from the server, using a specific hash. If the data was compressed or serialized when compressed, it will automatically
be decompressed or serialized, as appropriate. (Inclusive or)

Non-serialized data will be returned as a string, so explicit conversion to
numeric types will be necessary, if desired

Overrides:
get in class MemCachedClient
Parameters:
key - key where data is stored
hashCode - if not null, then the int hashcode to use
asString - if true, then return string val
Returns:
the object that was previously stored, or null if it was not previously stored

getMulti

public Map<String,Object> getMulti(String[] keys,
                                   Integer[] hashCodes,
                                   boolean asString)
Description copied from class: MemCachedClient
Retrieve multiple keys from the memcache. This is recommended over repeated calls to get(), since it
is more efficient.

Overrides:
getMulti in class MemCachedClient
Parameters:
keys - keys to retrieve
hashCodes - if not null, then the Integer array of hashCodes
asString - if true then retrieve using String val
Returns:
a hashmap with entries for each key is found by the server, keys that are not found are not entered into the hashmap, but attempting to retrieve them from the hashmap gives you null.


Copyright © 2012 Schooner Information Technology. All Rights Reserved.