|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.whalin.MemCached.MemCachedClient
com.schooner.MemCached.AscIIUDPClient
public class AscIIUDPClient
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).
BinaryClient
Field Summary | |
---|---|
static byte |
B_DELIMITER
|
static byte |
B_RETURN
|
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 |
---|
public static final byte B_DELIMITER
public static final byte B_RETURN
Constructor Detail |
---|
public AscIIUDPClient()
public AscIIUDPClient(String poolName)
poolName
- name of SockIOPoolbinaryProtocal
- whether use binary protocol.public AscIIUDPClient(String poolName, ClassLoader cl, ErrorHandler eh)
Method Detail |
---|
public boolean isUseBinaryProtocol()
isUseBinaryProtocol
in class MemCachedClient
public boolean set(String key, Object value)
MemCachedClient
set
in class MemCachedClient
key
- key to store data undervalue
- value to store
public boolean set(String key, Object value, Integer hashCode)
MemCachedClient
set
in class MemCachedClient
key
- key to store data undervalue
- value to storehashCode
- if not null, then the int hashcode to use
public boolean set(String key, Object value, Date expiry)
MemCachedClient
set
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the record
public boolean set(String key, Object value, Date expiry, Integer hashCode)
MemCachedClient
set
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the recordhashCode
- if not null, then the int hashcode to use
public boolean add(String key, Object value)
MemCachedClient
add
in class MemCachedClient
key
- key to store data undervalue
- value to store
public boolean add(String key, Object value, Integer hashCode)
MemCachedClient
add
in class MemCachedClient
key
- key to store data undervalue
- value to storehashCode
- if not null, then the int hashcode to use
public boolean add(String key, Object value, Date expiry)
MemCachedClient
add
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the record
public boolean add(String key, Object value, Date expiry, Integer hashCode)
MemCachedClient
add
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the recordhashCode
- if not null, then the int hashcode to use
public boolean append(String key, Object value, Integer hashCode)
append
in class MemCachedClient
public boolean append(String key, Object value)
append
in class MemCachedClient
public boolean cas(String key, Object value, Integer hashCode, long casUnique)
cas
in class MemCachedClient
public boolean cas(String key, Object value, Date expiry, long casUnique)
cas
in class MemCachedClient
public boolean cas(String key, Object value, Date expiry, Integer hashCode, long casUnique)
cas
in class MemCachedClient
public boolean cas(String key, Object value, long casUnique)
cas
in class MemCachedClient
public boolean prepend(String key, Object value, Integer hashCode)
prepend
in class MemCachedClient
public boolean prepend(String key, Object value)
prepend
in class MemCachedClient
public boolean replace(String key, Object value)
MemCachedClient
replace
in class MemCachedClient
key
- key to store data undervalue
- value to store
public boolean replace(String key, Object value, Integer hashCode)
MemCachedClient
replace
in class MemCachedClient
key
- key to store data undervalue
- value to storehashCode
- if not null, then the int hashcode to use
public boolean replace(String key, Object value, Date expiry)
MemCachedClient
replace
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the record
public boolean replace(String key, Object value, Date expiry, Integer hashCode)
MemCachedClient
replace
in class MemCachedClient
key
- key to store data undervalue
- value to storeexpiry
- when to expire the recordhashCode
- if not null, then the int hashcode to use
public void setTransCoder(TransCoder transCoder)
setTransCoder
in class MemCachedClient
transCoder
- public long addOrDecr(String key)
MemCachedClient
addOrDecr
in class MemCachedClient
key
- key where the data is stored
public long addOrDecr(String key, long inc)
MemCachedClient
addOrDecr
in class MemCachedClient
key
- key where the data is storedinc
- value to set or increment by
public long addOrDecr(String key, long inc, Integer hashCode)
MemCachedClient
addOrDecr
in class MemCachedClient
key
- key where the data is storedinc
- value to set or increment byhashCode
- if not null, then the int hashcode to use
public long addOrIncr(String key)
MemCachedClient
addOrIncr
in class MemCachedClient
key
- key where the data is stored
public long addOrIncr(String key, long inc)
MemCachedClient
addOrIncr
in class MemCachedClient
key
- key where the data is storedinc
- value to set or increment by
public long addOrIncr(String key, long inc, Integer hashCode)
MemCachedClient
addOrIncr
in class MemCachedClient
key
- key where the data is storedinc
- value to set or increment byhashCode
- if not null, then the int hashcode to use
public long decr(String key)
MemCachedClient
decr
in class MemCachedClient
key
- key where the data is stored
public long decr(String key, long inc)
MemCachedClient
decr
in class MemCachedClient
key
- key where the data is storedinc
- how much to increment by
public long decr(String key, long inc, Integer hashCode)
MemCachedClient
decr
in class MemCachedClient
key
- key where the data is storedinc
- how much to increment byhashCode
- if not null, then the int hashcode to use
public boolean delete(String key)
MemCachedClient
delete
in class MemCachedClient
key
- the key to be removed
true
, if the data was deleted successfullypublic boolean delete(String key, Date expiry)
MemCachedClient
delete
in class MemCachedClient
key
- the key to be removedexpiry
- when to expire the record.
true
, if the data was deleted successfullypublic boolean flushAll()
MemCachedClient
flushAll
in class MemCachedClient
public boolean flushAll(String[] servers)
MemCachedClient
flushAll
in class MemCachedClient
servers
- optional array of host(s) to flush (host:port)
public Object get(String key)
MemCachedClient
get
in class MemCachedClient
key
- key where data is stored
public Object get(String key, Integer hashCode)
MemCachedClient
get
in class MemCachedClient
key
- key where data is storedhashCode
- if not null, then the int hashcode to use
public Map<String,Object> getMulti(String[] keys)
MemCachedClient
get()
,
since it
getMulti
in class MemCachedClient
keys
- String array of keys to retrieve
public Map<String,Object> getMulti(String[] keys, Integer[] hashCodes)
MemCachedClient
get()
,
since it
getMulti
in class MemCachedClient
keys
- keys to retrievehashCodes
- if not null, then the Integer array of hashCodes
public Object[] getMultiArray(String[] keys)
MemCachedClient
get()
,
since it
getMultiArray
in class MemCachedClient
keys
- String array of keys to retrieve
public Object[] getMultiArray(String[] keys, Integer[] hashCodes)
MemCachedClient
get()
,
since it
getMultiArray
in class MemCachedClient
keys
- String array of keys to retrievehashCodes
- if not null, then the Integer array of hashCodes
public Object[] getMultiArray(String[] keys, Integer[] hashCodes, boolean asString)
get()
,
since it
getMultiArray
in class MemCachedClient
keys
- String array of keys to retrievehashCodes
- if not null, then the Integer array of hashCodesasString
- if true, retrieve string vals
public MemcachedItem gets(String key)
gets
in class MemCachedClient
public MemcachedItem gets(String key, Integer hashCode)
gets
in class MemCachedClient
public long incr(String key)
MemCachedClient
incr
in class MemCachedClient
key
- key where the data is stored
public long incr(String key, long inc)
MemCachedClient
incr
in class MemCachedClient
key
- key where the data is storedinc
- how much to increment by
public long incr(String key, long inc, Integer hashCode)
MemCachedClient
incr
in class MemCachedClient
key
- key where the data is storedinc
- how much to increment byhashCode
- if not null, then the int hashcode to use
public boolean keyExists(String key)
MemCachedClient
keyExists
in class MemCachedClient
key
- the key to look for
public Map<String,Map<String,String>> stats()
MemCachedClient
stats
in class MemCachedClient
public Map<String,Map<String,String>> stats(String[] servers)
MemCachedClient
stats
in class MemCachedClient
servers
- string array of servers to retrieve stats from, or all if this
is null
public Map<String,Map<String,String>> statsCacheDump(int slabNumber, int limit)
MemCachedClient
statsCacheDump
in class MemCachedClient
slabNumber
- the item number of the cache dump
public Map<String,Map<String,String>> statsCacheDump(String[] servers, int slabNumber, int limit)
MemCachedClient
statsCacheDump
in class MemCachedClient
servers
- string array of servers to retrieve stats from, or all if this
is nullslabNumber
- the item number of the cache dump
public Map<String,Map<String,String>> statsItems()
MemCachedClient
statsItems
in class MemCachedClient
public Map<String,Map<String,String>> statsItems(String[] servers)
MemCachedClient
statsItems
in class MemCachedClient
servers
- string array of servers to retrieve stats from, or all if this
is null
public Map<String,Map<String,String>> statsSlabs()
MemCachedClient
statsSlabs
in class MemCachedClient
public Map<String,Map<String,String>> statsSlabs(String[] servers)
MemCachedClient
statsSlabs
in class MemCachedClient
servers
- string array of servers to retrieve stats from, or all if this
is null
public boolean sync(String key, Integer hashCode)
sync
in class MemCachedClient
public boolean sync(String key)
sync
in class MemCachedClient
public boolean syncAll()
syncAll
in class MemCachedClient
public boolean syncAll(String[] servers)
syncAll
in class MemCachedClient
public boolean delete(String key, Integer hashCode, Date expiry)
MemCachedClient
add
and
replace
set
will succeed,
delete
in class MemCachedClient
key
- 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 void setDefaultEncoding(String defaultEncoding)
MemCachedClient
setDefaultEncoding
in class MemCachedClient
public void setPrimitiveAsString(boolean primitiveAsString)
MemCachedClient
setPrimitiveAsString
in class MemCachedClient
primitiveAsString
- if true, then store all primitives as their string value.public void setSanitizeKeys(boolean sanitizeKeys)
MemCachedClient
setSanitizeKeys
in class MemCachedClient
sanitizeKeys
- if true, then URLEncode all keyspublic Object get(String key, Integer hashCode, boolean asString)
MemCachedClient
get
in class MemCachedClient
key
- key where data is storedhashCode
- if not null, then the int hashcode to useasString
- if true, then return string val
public Map<String,Object> getMulti(String[] keys, Integer[] hashCodes, boolean asString)
MemCachedClient
get()
,
since it
getMulti
in class MemCachedClient
keys
- keys to retrievehashCodes
- if not null, then the Integer array of hashCodesasString
- if true then retrieve using String val
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |