T
- The meta data type of the cache.V
- The raw data type of the cache.@Singleton public class MemTupleDataCache<T extends Serializable,V extends Serializable> extends MemDataCache<TupleDataCache.DataEntry<String,T,V>> implements TupleDataCache<String,T,V>
Modifier and Type | Class and Description |
---|---|
static class |
MemTupleDataCache.DataEntry<T extends Serializable,V extends Serializable>
Memcached implementation of the data cache entry of the tuple data cache.
|
Constructor and Description |
---|
MemTupleDataCache()
Constructor using a default memcached client.
|
MemTupleDataCache(net.spy.memcached.MemcachedClient client)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TupleDataCache.DataEntry<String,T,V> |
get(String key)
Read data from cache.
|
V |
getDataValue(String key)
Read the raw data from cache.
|
protected String |
hash(String key)
Get the hash encoding of a key string.
|
boolean |
set(String key,
T meta,
V value)
Given a key, put a complete data entry in the data cache.
|
clear, set
public MemTupleDataCache() throws IOException
IOException
- if the memcached client fails to start.public MemTupleDataCache(net.spy.memcached.MemcachedClient client)
client
- The memcached client to support this cache.protected String hash(String key)
key
- The input string to encode.public V getDataValue(String key)
TupleDataCache
getDataValue
in interface TupleDataCache<String,T extends Serializable,V extends Serializable>
key
- The key whose associated value is to be returnednull
if this map contains no mapping for
the keypublic TupleDataCache.DataEntry<String,T,V> get(String key)
DataCache
get
in interface DataCache<TupleDataCache.DataEntry<String,T extends Serializable,V extends Serializable>>
get
in interface TupleDataCache<String,T extends Serializable,V extends Serializable>
get
in class MemDataCache<TupleDataCache.DataEntry<String,T extends Serializable,V 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 meta, V value)
TupleDataCache
set
in interface TupleDataCache<String,T extends Serializable,V extends Serializable>
key
- The key of the cache entry.meta
- The metadata associated with the raw data.value
- The raw data to store in to the cache.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.