|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ToolkitCache<K,V>
A toolkit cache. A toolkit cache can be configured using various configs available in ToolkitConfigFields
.
Consult Toolkit.getCache(String, Configuration, Class)
for more info on various
configs.
Consult the class level docs
for more info on behavior regarding destroy.
Trying to add values that are not serializable will throw NotSerializableRuntimeException
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Method Summary | |
---|---|
void |
addListener(ToolkitCacheListener<K> listener)
Adds a listener to this cache - the listener will not be added again if it's already registered. |
ToolkitReadWriteLock |
createLockForKey(K key)
Creates a ToolkitReadWriteLock for the given key. |
Map<K,V> |
getAll(Collection<? extends K> keys)
Perform get for the given set of keys. |
Map<K,V> |
getAllQuiet(Collection<K> keys)
Similar to getAll(Collection) , but doesn't update lastAccessedTime |
Configuration |
getConfiguration()
Returns the configuration of this cache. |
V |
getQuiet(Object key)
Same as Map.get(Object) but does not update the lastAccessedTime |
V |
putIfAbsent(K key,
V value,
long createTimeInSecs,
int maxTTISeconds,
int maxTTLSeconds)
Similar to ConcurrentMap.putIfAbsent(Object, Object) but with ability to specify creation time, tti, ttl
etc. |
void |
putNoReturn(K key,
V value)
Behaves the same as the standard Map.put(Object, Object) method except that the previous value is not
returned. |
void |
putNoReturn(K key,
V value,
long createTimeInSecs,
int maxTTISeconds,
int maxTTLSeconds)
Similar to putNoReturn(Object, Object) but with ability to specify creation time, tti, ttl etc |
void |
removeListener(ToolkitCacheListener<K> listener)
Removes a registered listener from this cache. |
void |
removeNoReturn(Object key)
Behaves the same as the standard Map.remove(Object) method except that the previous value is not returned. |
void |
setConfigField(String name,
Serializable value)
Updates the configuration of the Cache using passed in value. |
Methods inherited from interface java.util.concurrent.ConcurrentMap |
---|
putIfAbsent, remove, replace, replace |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from interface org.terracotta.toolkit.object.Destroyable |
---|
destroy, isDestroyed |
Methods inherited from interface org.terracotta.toolkit.search.SearchableMap |
---|
createQueryBuilder, setAttributeExtractor |
Methods inherited from interface org.terracotta.toolkit.bulkload.ToolkitBulkLoadObject |
---|
isBulkLoadEnabled, isNodeBulkLoadEnabled, setNodeBulkLoadEnabled, waitUntilBulkLoadComplete |
Methods inherited from interface org.terracotta.toolkit.object.ToolkitObject |
---|
getName |
Method Detail |
---|
void removeNoReturn(Object key)
Map.remove(Object)
method except that the previous value is not returned.
This may provide significant performance improvements when the old value is not required.
key
- the key of the entry to removevoid putNoReturn(K key, V value)
Map.put(Object, Object)
method except that the previous value is not
returned. This may provide significant performance improvements when old value is not required.
key
- the key of the entryvalue
- the value of the entryMap<K,V> getAll(Collection<? extends K> keys)
keys
- the collection of keys to lookup
Configuration getConfiguration()
void setConfigField(String name, Serializable value)
IllegalArgumentException
if the config
field name
is not dynamic and cannot be changed at runtime
ToolkitReadWriteLock createLockForKey(K key)
ToolkitReadWriteLock
for the given key.
NOTE: ToolkitObject.getName()
on the ToolkitReadWriteLock
,
ToolkitReadWriteLock.readLock()
and ToolkitReadWriteLock.writeLock()
will return null
key
- the key for which a lock will be returned
ToolkitReadWriteLock
that can be used to perform primitive locking operations on the
keyV getQuiet(Object key)
Map.get(Object)
but does not update the lastAccessedTime
key
- the key
Map<K,V> getAllQuiet(Collection<K> keys)
getAll(Collection)
, but doesn't update lastAccessedTime
keys
- the collection of keys to lookup
void putNoReturn(K key, V value, long createTimeInSecs, int maxTTISeconds, int maxTTLSeconds)
putNoReturn(Object, Object)
but with ability to specify creation time, tti, ttl etc
key
- the keyvalue
- the valuecreateTimeInSecs
- creation time in seconds since epochmaxTTISeconds
- tti of the entrymaxTTLSeconds
- ttl of the entryV putIfAbsent(K key, V value, long createTimeInSecs, int maxTTISeconds, int maxTTLSeconds)
ConcurrentMap.putIfAbsent(Object, Object)
but with ability to specify creation time, tti, ttl
etc.
key
- the keyvalue
- the valuecreateTimeInSecs
- creation time in seconds since epochmaxTTISeconds
- tti of the entrymaxTTLSeconds
- ttl of the entry
void addListener(ToolkitCacheListener<K> listener)
void removeListener(ToolkitCacheListener<K> listener)
listener
is not registered already
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |