com.caucho.memcached
Class MemcachedClient
java.lang.Object
com.caucho.memcached.MemcachedClient
- All Implemented Interfaces:
- java.lang.Iterable, Cache, CacheLifecycle
public class MemcachedClient
- extends java.lang.Object
- implements Cache
Custom serialization for the cache
|
Method Summary |
void |
addAddress(java.lang.String address)
|
void |
addServer(java.lang.String address,
int port)
|
boolean |
containsKey(java.lang.Object key)
|
java.lang.Object |
get(java.lang.Object key)
Returns the object specified by the given key. |
java.util.Map |
getAll(java.util.Set keys)
|
java.lang.Object |
getAndPut(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
getAndRemove(java.lang.Object key)
|
java.lang.Object |
getAndReplace(java.lang.Object key,
java.lang.Object value)
|
CacheManager |
getCacheManager()
|
CacheConfiguration |
getConfiguration()
|
CacheMXBean |
getMBean()
|
java.lang.String |
getName()
|
CacheStatistics |
getStatistics()
|
Status |
getStatus()
|
void |
init()
|
java.lang.Object |
invokeEntryProcessor(java.lang.Object key,
Cache.EntryProcessor entryProcessor)
|
java.util.Iterator |
iterator()
|
java.util.concurrent.Future |
load(java.lang.Object key)
|
java.util.concurrent.Future |
loadAll(java.util.Set keys)
|
void |
put(java.lang.Object key,
java.lang.Object value)
Puts a new item in the cache. |
void |
putAll(java.util.Map map)
|
boolean |
putIfAbsent(java.lang.Object key,
java.lang.Object value)
|
boolean |
registerCacheEntryListener(CacheEntryListener listener,
Filter filter)
|
boolean |
remove(java.lang.Object key)
|
boolean |
remove(java.lang.Object key,
java.lang.Object oldValue)
|
void |
removeAll()
|
void |
removeAll(java.util.Set keys)
|
boolean |
replace(java.lang.Object key,
java.lang.Object value)
|
boolean |
replace(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue)
|
void |
setCluster(java.lang.String cluster)
|
void |
setPort(int port)
|
void |
start()
|
void |
stop()
|
java.lang.String |
toString()
|
boolean |
unregisterCacheEntryListener(CacheEntryListener listener)
|
java.lang.Object |
unwrap(java.lang.Class cl)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MemcachedClient
public MemcachedClient()
MemcachedClient
public MemcachedClient(java.lang.String name)
addServer
public void addServer(java.lang.String address,
int port)
addAddress
public void addAddress(java.lang.String address)
setCluster
public void setCluster(java.lang.String cluster)
setPort
public void setPort(int port)
containsKey
public boolean containsKey(java.lang.Object key)
throws CacheException
- Specified by:
containsKey in interface Cache
- Throws:
CacheException
get
public java.lang.Object get(java.lang.Object key)
throws CacheException
- Description copied from interface:
Cache
- Returns the object specified by the given key.
If the item does not exist and a CacheLoader has been specified,
the CacheLoader will be used to create a cache value.
- Specified by:
get in interface Cache
- Throws:
CacheException
put
public void put(java.lang.Object key,
java.lang.Object value)
throws CacheException
- Description copied from interface:
Cache
- Puts a new item in the cache.
- Specified by:
put in interface Cache
- Parameters:
key - the key of the item to putvalue - the value of the item to put
- Throws:
CacheException
remove
public boolean remove(java.lang.Object key)
throws CacheException
- Specified by:
remove in interface Cache
- Throws:
CacheException
init
@PostConstruct
public void init()
getAndPut
public java.lang.Object getAndPut(java.lang.Object key,
java.lang.Object value)
throws CacheException
- Specified by:
getAndPut in interface Cache
- Throws:
CacheException
getAndRemove
public java.lang.Object getAndRemove(java.lang.Object key)
throws CacheException
- Specified by:
getAndRemove in interface Cache
- Throws:
CacheException
getAndReplace
public java.lang.Object getAndReplace(java.lang.Object key,
java.lang.Object value)
throws CacheException
- Specified by:
getAndReplace in interface Cache
- Throws:
CacheException
getStatistics
public CacheStatistics getStatistics()
- Specified by:
getStatistics in interface Cache
getConfiguration
public CacheConfiguration getConfiguration()
- Specified by:
getConfiguration in interface Cache
getName
public java.lang.String getName()
- Specified by:
getName in interface Cache
load
public java.util.concurrent.Future load(java.lang.Object key)
throws CacheException
- Specified by:
load in interface Cache
- Throws:
CacheException
loadAll
public java.util.concurrent.Future loadAll(java.util.Set keys)
throws CacheException
- Specified by:
loadAll in interface Cache
- Throws:
CacheException
putAll
public void putAll(java.util.Map map)
throws CacheException
- Specified by:
putAll in interface Cache
- Throws:
CacheException
putIfAbsent
public boolean putIfAbsent(java.lang.Object key,
java.lang.Object value)
throws CacheException
- Specified by:
putIfAbsent in interface Cache
- Throws:
CacheException
registerCacheEntryListener
public boolean registerCacheEntryListener(CacheEntryListener listener,
Filter filter)
- Specified by:
registerCacheEntryListener in interface Cache
remove
public boolean remove(java.lang.Object key,
java.lang.Object oldValue)
throws CacheException
- Specified by:
remove in interface Cache
- Throws:
CacheException
removeAll
public void removeAll()
throws CacheException
- Specified by:
removeAll in interface Cache
- Throws:
CacheException
replace
public boolean replace(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue)
throws CacheException
- Specified by:
replace in interface Cache
- Throws:
CacheException
replace
public boolean replace(java.lang.Object key,
java.lang.Object value)
throws CacheException
- Specified by:
replace in interface Cache
- Throws:
CacheException
unregisterCacheEntryListener
public boolean unregisterCacheEntryListener(CacheEntryListener listener)
- Specified by:
unregisterCacheEntryListener in interface Cache
iterator
public java.util.Iterator iterator()
- Specified by:
iterator in interface java.lang.Iterable- Specified by:
iterator in interface Cache
getStatus
public Status getStatus()
- Specified by:
getStatus in interface CacheLifecycle
start
public void start()
throws CacheException
- Specified by:
start in interface CacheLifecycle
- Throws:
CacheException
getMBean
public CacheMXBean getMBean()
- Specified by:
getMBean in interface Cache
stop
public void stop()
throws CacheException
- Specified by:
stop in interface CacheLifecycle
- Throws:
CacheException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
unwrap
public java.lang.Object unwrap(java.lang.Class cl)
- Specified by:
unwrap in interface Cache
getAll
public java.util.Map getAll(java.util.Set keys)
- Specified by:
getAll in interface Cache
invokeEntryProcessor
public java.lang.Object invokeEntryProcessor(java.lang.Object key,
Cache.EntryProcessor entryProcessor)
- Specified by:
invokeEntryProcessor in interface Cache
removeAll
public void removeAll(java.util.Set keys)
- Specified by:
removeAll in interface Cache
getCacheManager
public CacheManager getCacheManager()
- Specified by:
getCacheManager in interface Cache