|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.cache.impl.LocalCache<K,V>
public class LocalCache<K,V>
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected ConcurrentDistributedMap<K,TimestampedValue<V>> |
data
|
| Constructor Summary | |
|---|---|
LocalCache(CacheConfig config)
Construct with the map configuration |
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
FinegrainedLock |
createFinegrainedLock(K key)
Obtain a fine-grained lock instance for a particular key. |
Set<Map.Entry<K,V>> |
entrySet()
|
void |
evictExpiredLocalElements()
Trigger to walk through the local elements, look for expired elements, and evict them. |
void |
evictOrphanElements(com.tc.cluster.DsoCluster cluster)
Trigger to walk through the specified set of orphaned elements, check whether they have expired, and evict them from the store. |
V |
get(Object key)
|
CacheConfig |
getConfig()
Get the current config for the cache (which may or may not be the config passed to the cache originally. |
String |
getLockIdForKey(K key)
Retrieves a lock ID that's specific for this cache and key. |
EvictionStatistics |
getStatistics()
Retrieve the statistics for the current JVM. |
TimeSource |
getTimeSource()
|
TimestampedValue<V> |
getTimestampedValue(Object key)
Get the value wrapped in a timestamped object. |
TimestampedValue<V> |
getTimestampedValueQuiet(Object key)
Get the value wrapped in a timestamped object without updating the last usage statistics. |
void |
initializeOnLoad()
Further initialize this object and launch the eviction thread. |
boolean |
isEmpty()
|
protected boolean |
isEvictionEnabled()
|
boolean |
isStatisticsEnabled()
Returns whether statistics are enabled. |
Set<K> |
keySet()
|
int |
localSize()
Get the number of elements local in the current node - this number should always be less than size(), and is likely to be different. |
void |
lockEntry(K key)
Lock the entry corresponding to this key. |
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> t)
|
V |
putIfAbsent(K key,
V value)
|
void |
putNoReturn(K key,
V value)
Put the key/value into the map, replacing the existing value if present. |
V |
remove(Object key)
|
boolean |
remove(Object key,
Object value)
|
void |
removeNoReturn(Object key)
Remove the key from the map, if it exists. |
TimestampedValue<V> |
removeTimestampedValue(K key)
Remove the timestamped value for the given key. |
V |
replace(K key,
V value)
|
boolean |
replace(K key,
V oldValue,
V newValue)
|
void |
setStatisticsEnabled(boolean enabled)
Toggle statistics being enabled or not. |
void |
setTimeSource(TimeSource timeSource)
This is provided for testing purposes - it lets you override the source of System.currentTimeMillis() so that you can control it yourself in the test. |
void |
shutdown()
Shut down the background eviction thread, if any. |
int |
size()
|
void |
unlockEntry(K key)
Unlock the entry corresponding to this key |
Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
protected final ConcurrentDistributedMap<K,TimestampedValue<V>> data
| Constructor Detail |
|---|
public LocalCache(CacheConfig config)
config - The configuration| Method Detail |
|---|
public void initializeOnLoad()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>public V get(Object key)
get in interface Map<K,V>public TimestampedValue<V> getTimestampedValue(Object key)
DistributedCache
getTimestampedValue in interface DistributedCache<K,V>key - The key to search for
public TimestampedValue<V> getTimestampedValueQuiet(Object key)
DistributedCache
getTimestampedValueQuiet in interface DistributedCache<K,V>key - The key to search for
DistributedCache.getTimestampedValue(Object)public TimestampedValue<V> removeTimestampedValue(K key)
DistributedCache
removeTimestampedValue in interface DistributedCache<K,V>key - The key to search for
public Set<K> keySet()
keySet in interface Map<K,V>
public V put(K key,
V value)
put in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public void clear()
clear in interface Map<K,V>public int size()
size in interface Map<K,V>public int localSize()
DistributedCache
localSize in interface DistributedCache<K,V>public void shutdown()
DistributedCache
shutdown in interface DistributedCache<K,V>public void evictExpiredLocalElements()
Evictable
evictExpiredLocalElements in interface Evictable<K>public void evictOrphanElements(com.tc.cluster.DsoCluster cluster)
Evictable
evictOrphanElements in interface Evictable<K>cluster - The dso cluster info which can be used to obtain the orphaned element listpublic void setTimeSource(TimeSource timeSource)
timeSource - The alternate TimeSource implementationpublic TimeSource getTimeSource()
public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>
public void putNoReturn(K key,
V value)
DistributedCache
putNoReturn in interface DistributedCache<K,V>key - Keyvalue - Valuepublic void removeNoReturn(Object key)
DistributedCache
removeNoReturn in interface DistributedCache<K,V>key - Key
public V putIfAbsent(K key,
V value)
putIfAbsent in interface ConcurrentMap<K,V>
public V replace(K key,
V value)
replace in interface ConcurrentMap<K,V>public boolean isStatisticsEnabled()
Evictable
isStatisticsEnabled in interface Evictable<K>true�when statistics are enabled; and false otherwisepublic void setStatisticsEnabled(boolean enabled)
Evictable
setStatisticsEnabled in interface Evictable<K>enabled - true to enable statistics; and {@code false) to disable thempublic EvictionStatistics getStatistics()
Evictable
getStatistics in interface Evictable<K>public CacheConfig getConfig()
DistributedCache
getConfig in interface DistributedCache<K,V>protected boolean isEvictionEnabled()
public boolean remove(Object key,
Object value)
remove in interface ConcurrentMap<K,V>
public boolean replace(K key,
V oldValue,
V newValue)
replace in interface ConcurrentMap<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public void putAll(Map<? extends K,? extends V> t)
putAll in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>public FinegrainedLock createFinegrainedLock(K key)
LockableMap
createFinegrainedLock in interface LockableMap<K>key - the key for which a fine-grained lock has to be constructed
public void lockEntry(K key)
LockableMap
lockEntry in interface LockableMap<K>key - the key for which all entry accesses have to be lockedpublic void unlockEntry(K key)
LockableMap
unlockEntry in interface LockableMap<K>key - the key for which all entry accesses have to be unlockedpublic String getLockIdForKey(K key)
DistributedCache
getLockIdForKey in interface DistributedCache<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||