public class AscIIClient extends MemCachedClient
MemCachedClient for accessing the
memcached server.BinaryClient| Modifier and Type | Class and Description |
|---|---|
protected class |
AscIIClient.NIOLoader |
AUTH_FAILED, B_DELETED, B_END, B_NOTFOUND, B_RETURN, 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 and Description |
|---|
AscIIClient()
Creates a new instance of MemCachedClient.
|
AscIIClient(String poolName)
Creates a new instance of MemCachedClient accepting a passed in pool
name.
|
AscIIClient(String poolName,
ClassLoader cl,
ErrorHandler eh) |
| Modifier and Type | Method and Description |
|---|---|
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) |
MemcachedItem |
gets(String cmd,
String key,
Integer hashCode,
boolean asString) |
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) |
getCounter, getCounter, setClassLoader, setCompressEnable, setCompressThreshold, setErrorHandler, storeCounter, storeCounter, storeCounter, storeCounterpublic AscIIClient()
public AscIIClient(String poolName)
poolName - name of SockIOPoolbinaryProtocal - whether use binary protocol.public AscIIClient(String poolName, ClassLoader cl, ErrorHandler eh)
public boolean isUseBinaryProtocol()
isUseBinaryProtocol in class MemCachedClientpublic boolean keyExists(String key)
MemCachedClientkeyExists in class MemCachedClientkey - the key to look forpublic boolean delete(String key)
MemCachedClientdelete in class MemCachedClientkey - the key to be removedtrue, if the data was deleted successfullypublic boolean delete(String key, Date expiry)
MemCachedClientdelete in class MemCachedClientkey - the key to be removedexpiry - when to expire the record.true, if the data was deleted successfullypublic boolean delete(String key, Integer hashCode, Date expiry)
MemCachedClientadd and
replaceset will succeed,delete in class MemCachedClientkey - the key to be removedhashCode - if not null, then the int hashcode to useexpiry - when to expire the record.true, if the data was deleted successfullypublic boolean set(String key, Object value)
MemCachedClientset in class MemCachedClientkey - key to store data undervalue - value to storepublic boolean set(String key, Object value, Integer hashCode)
MemCachedClientset in class MemCachedClientkey - key to store data undervalue - value to storehashCode - if not null, then the int hashcode to usepublic boolean set(String key, Object value, Date expiry)
MemCachedClientset in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordpublic boolean set(String key, Object value, Date expiry, Integer hashCode)
MemCachedClientset in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordhashCode - if not null, then the int hashcode to usepublic boolean add(String key, Object value)
MemCachedClientadd in class MemCachedClientkey - key to store data undervalue - value to storepublic boolean add(String key, Object value, Integer hashCode)
MemCachedClientadd in class MemCachedClientkey - key to store data undervalue - value to storehashCode - if not null, then the int hashcode to usepublic boolean add(String key, Object value, Date expiry)
MemCachedClientadd in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordpublic boolean add(String key, Object value, Date expiry, Integer hashCode)
MemCachedClientadd in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordhashCode - if not null, then the int hashcode to usepublic boolean append(String key, Object value, Integer hashCode)
append in class MemCachedClientpublic boolean append(String key, Object value)
append in class MemCachedClientpublic boolean cas(String key, Object value, Integer hashCode, long casUnique)
cas in class MemCachedClientpublic boolean cas(String key, Object value, Date expiry, long casUnique)
cas in class MemCachedClientpublic boolean cas(String key, Object value, Date expiry, Integer hashCode, long casUnique)
cas in class MemCachedClientpublic boolean cas(String key, Object value, long casUnique)
cas in class MemCachedClientpublic boolean prepend(String key, Object value, Integer hashCode)
prepend in class MemCachedClientpublic boolean prepend(String key, Object value)
prepend in class MemCachedClientpublic boolean replace(String key, Object value)
MemCachedClientreplace in class MemCachedClientkey - key to store data undervalue - value to storepublic boolean replace(String key, Object value, Integer hashCode)
MemCachedClientreplace in class MemCachedClientkey - key to store data undervalue - value to storehashCode - if not null, then the int hashcode to usepublic boolean replace(String key, Object value, Date expiry)
MemCachedClientreplace in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordpublic boolean replace(String key, Object value, Date expiry, Integer hashCode)
MemCachedClientreplace in class MemCachedClientkey - key to store data undervalue - value to storeexpiry - when to expire the recordhashCode - if not null, then the int hashcode to usepublic long addOrIncr(String key)
MemCachedClientaddOrIncr in class MemCachedClientkey - key where the data is storedpublic long addOrIncr(String key, long inc)
MemCachedClientaddOrIncr in class MemCachedClientkey - key where the data is storedinc - value to set or increment bypublic long addOrIncr(String key, long inc, Integer hashCode)
MemCachedClientaddOrIncr in class MemCachedClientkey - key where the data is storedinc - value to set or increment byhashCode - if not null, then the int hashcode to usepublic long addOrDecr(String key)
MemCachedClientaddOrDecr in class MemCachedClientkey - key where the data is storedpublic long addOrDecr(String key, long inc)
MemCachedClientaddOrDecr in class MemCachedClientkey - key where the data is storedinc - value to set or increment bypublic long addOrDecr(String key, long inc, Integer hashCode)
MemCachedClientaddOrDecr in class MemCachedClientkey - key where the data is storedinc - value to set or increment byhashCode - if not null, then the int hashcode to usepublic long incr(String key)
MemCachedClientincr in class MemCachedClientkey - key where the data is storedpublic long incr(String key, long inc)
MemCachedClientincr in class MemCachedClientkey - key where the data is storedinc - how much to increment bypublic long incr(String key, long inc, Integer hashCode)
MemCachedClientincr in class MemCachedClientkey - key where the data is storedinc - how much to increment byhashCode - if not null, then the int hashcode to usepublic long decr(String key)
MemCachedClientdecr in class MemCachedClientkey - key where the data is storedpublic long decr(String key, long inc)
MemCachedClientdecr in class MemCachedClientkey - key where the data is storedinc - how much to increment bypublic long decr(String key, long inc, Integer hashCode)
MemCachedClientdecr in class MemCachedClientkey - key where the data is storedinc - how much to increment byhashCode - if not null, then the int hashcode to usepublic Object get(String key)
MemCachedClientget in class MemCachedClientkey - key where data is storedpublic Object get(String key, Integer hashCode)
MemCachedClientget in class MemCachedClientkey - key where data is storedhashCode - if not null, then the int hashcode to usepublic MemcachedItem gets(String key)
gets in class MemCachedClientpublic MemcachedItem gets(String key, Integer hashCode)
gets in class MemCachedClientpublic Object get(String key, Integer hashCode, boolean asString)
get in class MemCachedClientkey - key where data is storedhashCode - if not null, then the int hashcode to useasString - if true, then return string valpublic MemcachedItem gets(String cmd, String key, Integer hashCode, boolean asString)
public void setTransCoder(TransCoder transCoder)
setTransCoder in class MemCachedClienttransCoder - public Object[] getMultiArray(String[] keys)
MemCachedClientget(),
since itgetMultiArray in class MemCachedClientkeys - String array of keys to retrievepublic Object[] getMultiArray(String[] keys, Integer[] hashCodes)
MemCachedClientget(),
since itgetMultiArray in class MemCachedClientkeys - String array of keys to retrievehashCodes - if not null, then the Integer array of hashCodespublic Object[] getMultiArray(String[] keys, Integer[] hashCodes, boolean asString)
get(),
since itgetMultiArray in class MemCachedClientkeys - String array of keys to retrievehashCodes - if not null, then the Integer array of hashCodesasString - if true, retrieve string valspublic Map<String,Object> getMulti(String[] keys)
MemCachedClientget(),
since itgetMulti in class MemCachedClientkeys - String array of keys to retrievepublic Map<String,Object> getMulti(String[] keys, Integer[] hashCodes)
MemCachedClientget(),
since itgetMulti in class MemCachedClientkeys - keys to retrievehashCodes - if not null, then the Integer array of hashCodespublic Map<String,Object> getMulti(String[] keys, Integer[] hashCodes, boolean asString)
get(),
since itgetMulti in class MemCachedClientkeys - keys to retrievehashCodes - if not null, then the Integer array of hashCodesasString - if true then retrieve using String valpublic boolean flushAll()
MemCachedClientflushAll in class MemCachedClientpublic boolean flushAll(String[] servers)
MemCachedClientflushAll in class MemCachedClientservers - optional array of host(s) to flush (host:port)public Map<String,Map<String,String>> stats()
MemCachedClientstats in class MemCachedClientpublic Map<String,Map<String,String>> stats(String[] servers)
MemCachedClientstats in class MemCachedClientservers - string array of servers to retrieve stats from, or all if this
is nullpublic Map<String,Map<String,String>> statsItems()
MemCachedClientstatsItems in class MemCachedClientpublic Map<String,Map<String,String>> statsItems(String[] servers)
MemCachedClientstatsItems in class MemCachedClientservers - string array of servers to retrieve stats from, or all if this
is nullpublic Map<String,Map<String,String>> statsSlabs()
MemCachedClientstatsSlabs in class MemCachedClientpublic Map<String,Map<String,String>> statsSlabs(String[] servers)
MemCachedClientstatsSlabs in class MemCachedClientservers - string array of servers to retrieve stats from, or all if this
is nullpublic Map<String,Map<String,String>> statsCacheDump(int slabNumber, int limit)
MemCachedClientstatsCacheDump in class MemCachedClientslabNumber - the item number of the cache dumppublic Map<String,Map<String,String>> statsCacheDump(String[] servers, int slabNumber, int limit)
MemCachedClientstatsCacheDump in class MemCachedClientservers - string array of servers to retrieve stats from, or all if this
is nullslabNumber - the item number of the cache dumppublic boolean sync(String key, Integer hashCode)
sync in class MemCachedClientpublic boolean sync(String key)
sync in class MemCachedClientpublic boolean syncAll()
syncAll in class MemCachedClientpublic boolean syncAll(String[] servers)
syncAll in class MemCachedClientpublic void setDefaultEncoding(String defaultEncoding)
MemCachedClientsetDefaultEncoding in class MemCachedClientpublic void setPrimitiveAsString(boolean primitiveAsString)
MemCachedClientsetPrimitiveAsString in class MemCachedClientprimitiveAsString - if true, then store all primitives as their string value.public void setSanitizeKeys(boolean sanitizeKeys)
MemCachedClientsetSanitizeKeys in class MemCachedClientsanitizeKeys - if true, then URLEncode all keysCopyright © 2013 Schooner Information Technology. All Rights Reserved.