T - Type of data@Singleton public class MemDataCache<T extends Serializable> extends Object implements DataCache<T>
| Constructor and Description |
|---|
MemDataCache()
Constructor using a default Memcached Client.
|
MemDataCache(net.spy.memcached.MemcachedClient client)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the mappings from this cache.
|
T |
get(String key)
Read data from cache.
|
boolean |
set(String key,
T value)
Put a value on a key in a data cache.
|
@Inject
public MemDataCache()
throws IOException
IOException - if the memcached client fails to startpublic MemDataCache(net.spy.memcached.MemcachedClient client)
client - The Memcached client to support this cachepublic T get(String key)
DataCacheget in interface DataCache<T extends Serializable>key - the key whose associated value is to be returnednull if this map contains no mapping for the
keypublic boolean set(String key, T value) throws IllegalStateException
DataCacheset in interface DataCache<T extends Serializable>key - the key under which this object should be added.value - the object to storeIllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic void clear()
DataCacheclear in interface DataCache<T extends Serializable>Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.