org.terracotta.cache
Class TerracottaDistributedCache<K,V>

java.lang.Object
  extended by org.terracotta.cache.TerracottaDistributedCache<K,V>
Type Parameters:
K - key type
V - value type
All Implemented Interfaces:
com.terracotta.toolkit.collections.InternalLocallyCacheable, ConcurrentMap<K,V>, Map<K,V>, CacheEvictionListener, DistributedCache<K,V>, Evictable<K>, IncoherentDistributedCache<K,V>, IncoherentDistributedCacheInternals<K,V>, LocallyCacheable, LockableMap<K>

public class TerracottaDistributedCache<K,V>
extends Object
implements IncoherentDistributedCacheInternals<K,V>, Evictable<K>, com.terracotta.toolkit.collections.InternalLocallyCacheable, CacheEvictionListener

A clusterable cache implementation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  ClusteredMap<K,TimestampedValue<V>> data
           
 
Constructor Summary
  TerracottaDistributedCache(CacheConfig config)
           
protected TerracottaDistributedCache(CacheConfig config, ClusteredMap<K,TimestampedValue<V>> terracottaMap)
           
 
Method Summary
 void clear()
           
 void clearLocalCache()
          Clears the local cache
 void clearWithCallback(MutationCallback<K,TimestampedValue<V>> callback)
           
 boolean containsKey(Object key)
           
 boolean containsKeyLocalOffHeap(Object key)
           
 boolean containsKeyLocalOnHeap(Object key)
           
 boolean containsLocalKey(K key)
           
 boolean containsValue(Object value)
           
 ClusteredLock createFinegrainedLock(K key)
          Obtain a fine-grained lock instance for a particular key.
 void destroyLocalCache()
           
 Set<Map.Entry<K,V>> entrySet()
           
 void evicted(Object key, Object value)
          Method called when elements are evicted.
 void evictExpiredLocalElements()
          Trigger to walk through the local elements, look for expired elements, and evict them.
 void evictOrphanElements(ClusterInfo clusterInfo)
          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.
protected  MutationCallback<K,TimestampedValue<V>> getEvictRemoveCallback()
           
 Map<K,Set<ClusterNode>> getNodesWithKeys(Collection<? extends K> keys)
           
 EvictionStatistics getStatistics()
          Retrieve the statistics for the current JVM.
 TimeSource getTimeSource()
          Return the time source used by this cache to generate entry timestamps.
 TimestampedValue<V> getTimestampedValue(K key)
          Get the value wrapped in a timestamped object.
 TimestampedValue<V> getTimestampedValueQuiet(K key)
          Get the value wrapped in a timestamped object without updating the last usage statistics.
 Map<K,TimestampedValue<V>> getTimestampedValues(Set<K> keys, boolean quiet)
           
 void initializeLocalCache()
           
 void initializeOnLoad()
          Terracotta method
protected  void initializeOnLoad(boolean startEviction)
           
protected  void invalidateCacheEntries(Iterator<K> keys)
           
protected  boolean isCapacityEvictionEnabled()
           
 boolean isEmpty()
           
protected  boolean isEvictionEnabled()
           
 boolean isPinned(Object key)
           
 boolean isStatisticsEnabled()
          Returns whether statistics are enabled.
 Set<K> keySet()
           
 Set<K> localKeySet()
           
 int localOffHeapSize()
           
 long localOffHeapSizeInBytes()
           
 int localOnHeapSize()
           
 long localOnHeapSizeInBytes()
           
 int localSize()
          Get the number of elements local in the current node.
 void lockEntry(K key)
          Lock the entry corresponding to this key.
 void markUsed(K key, Object entry, int now)
           
protected  void onEvict(K key, TimestampedValue<V> entry)
          Used to notify listeners of eviction.
protected  void onExpiry(K key, TimestampedValue<V> entry)
          Used to notify listeners of expiry.
 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.
 void putNoReturnWithCallback(K key, V value, MutationCallback<K,TimestampedValue<V>> callback)
           
 void recalculateLocalCacheSize(Object key)
           
 V remove(Object key)
           
 boolean remove(Object key, Object value)
           
 void removeNoReturn(Object key)
          Remove the key from the map, if it exists.
 void removeNoReturnWithCallback(K key, MutationCallback<K,TimestampedValue<V>> callback)
           
 TimestampedValue<V> removeTimestampedValue(K key)
          Remove the timestamped value for the given key.
 TimestampedValue<V> removeTimestampedValueWithCallback(K key, MutationCallback<K,TimestampedValue<V>> callback)
           
 V replace(K key, V value)
           
 boolean replace(K key, V oldValue, V newValue)
           
 void setLocalCacheEnabled(boolean enabled)
           
 void setMaxBytesLocalHeap(long maxBytesLocalHeap)
           
 void setMaxEntriesLocalHeap(int maxEntriesLocalHeap)
           
 void setMaxTTI(int maxTTI)
           
 void setMaxTTL(int maxTTL)
           
 void setPinned(Object key, boolean pinned)
           
 void setStatisticsEnabled(boolean enabled)
          Toggle statistics being enabled or not.
 void setTargetMaxTotalCount(int targetMaxTotalCount)
           
 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()
           
 boolean unlockedContainsKey(Object key)
          Same as Map.containsKey(Object) except this operation is performed without any locking
 V unlockedGet(K key, boolean quiet)
          Same as Map.get(Object) except this operation is performed without any locking
 Map<K,TimestampedValue<V>> unlockedGetAllTimestampedValue(Set<K> keys, boolean quiet)
           
 TimestampedValue<V> unlockedGetTimestampedValue(K key, boolean quiet)
          Same as IncoherentDistributedCache#unlockedGet(Object) except returns the TimestampedValue instead of the original value
 void unlockedPutIfAbsentNoReturn(K key, V value)
          Same as ConcurrentMap.putIfAbsent(Object, Object) except this operation is performed without any locking and the is performed only when a current mapping exists and is equal to currentValue
 void unlockedPutIfAbsentNoReturnWithCallback(K key, V value, MutationCallback<K,TimestampedValue<V>> callback)
           
 void unlockedPutNoReturn(K key, V value)
          Same as DistributedCache.putNoReturn(Object, Object) except that this operation is performed without any locking.
 void unlockedPutNoReturnWithCallback(K key, V value, MutationCallback<K,TimestampedValue<V>> callback)
           
 void unlockedRemoveNoReturn(K key, V currentValue)
          Same as DistributedCache.removeNoReturn(Object) except this operation is performed without any locking and the remove is performed only when a current mapping exists and is equal to currentValue
 void unlockedRemoveNoReturn(Object key)
          Same as DistributedCache.removeNoReturn(Object) except this operation is performed without any locking
 void unlockedRemoveNoReturnWithCallback(K key, MutationCallback<K,TimestampedValue<V>> callback)
           
 void unlockedRemoveNoReturnWithCallback(K key, V currentValue, MutationCallback<K,TimestampedValue<V>> callback)
           
 void unlockedReplaceNoReturn(K key, V currentValue, V newValue)
          Same as DistributedCache.putNoReturn(Object, Object) except that this operation is performed without any locking and puts in the cache only if there is already a mapping for key that is equal to currentValue
 void unlockedReplaceNoReturnWithCallback(K key, V currentValue, V newValue, MutationCallback<K,TimestampedValue<V>> callback)
           
 void unlockEntry(K key)
          Unlock the entry corresponding to this key
 void unpinAll()
           
 V unsafeGet(K key, boolean quiet)
          Returns the local value present for the key if present in the VM, otherwise returns null.
 TimestampedValue<V> unsafeGetTimestampedValue(K key, boolean quiet)
          Same as IncoherentDistributedCache.unsafeGet(Object, boolean) except returns the TimestampedValue instead of the original value
 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

data

protected final ClusteredMap<K,TimestampedValue<V>> data
Constructor Detail

TerracottaDistributedCache

public TerracottaDistributedCache(CacheConfig config)

TerracottaDistributedCache

protected TerracottaDistributedCache(CacheConfig config,
                                     ClusteredMap<K,TimestampedValue<V>> terracottaMap)
Method Detail

initializeOnLoad

public void initializeOnLoad()
Terracotta method


initializeOnLoad

protected void initializeOnLoad(boolean startEviction)

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,V>

get

public V get(Object key)
Specified by:
get in interface Map<K,V>

getTimestampedValue

public TimestampedValue<V> getTimestampedValue(K key)
Description copied from interface: DistributedCache
Get the value wrapped in a timestamped object.

This value is used entirely for maintaining the creation and last accessed time for TTI and TTL eviction.

Specified by:
getTimestampedValue in interface DistributedCache<K,V>
Parameters:
key - The key to search for
Returns:
The wrapped value or null if not found

getTimestampedValueQuiet

public TimestampedValue<V> getTimestampedValueQuiet(K key)
Description copied from interface: DistributedCache
Get the value wrapped in a timestamped object without updating the last usage statistics.

Specified by:
getTimestampedValueQuiet in interface DistributedCache<K,V>
Parameters:
key - The key to search for
Returns:
The wrapped value or null if not found
See Also:
DistributedCache.getTimestampedValue(Object)

getTimestampedValues

public Map<K,TimestampedValue<V>> getTimestampedValues(Set<K> keys,
                                                       boolean quiet)

removeTimestampedValue

public TimestampedValue<V> removeTimestampedValue(K key)
Description copied from interface: DistributedCache
Remove the timestamped value for the given key.

Previous values will be returned as null if they are expired.

Specified by:
removeTimestampedValue in interface DistributedCache<K,V>
Parameters:
key - The key to search for
Returns:
The wrapped value or null if not found or expired

removeTimestampedValueWithCallback

public TimestampedValue<V> removeTimestampedValueWithCallback(K key,
                                                              MutationCallback<K,TimestampedValue<V>> callback)

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K,V>

localKeySet

public Set<K> localKeySet()

containsLocalKey

public boolean containsLocalKey(K key)

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>

putIfAbsent

public V putIfAbsent(K key,
                     V value)
Specified by:
putIfAbsent in interface ConcurrentMap<K,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>

replace

public V replace(K key,
                 V value)
Specified by:
replace in interface ConcurrentMap<K,V>

clear

public void clear()
Specified by:
clear in interface Map<K,V>

clearLocalCache

public void clearLocalCache()
Description copied from interface: LocallyCacheable
Clears the local cache

Specified by:
clearLocalCache in interface LocallyCacheable

unpinAll

public void unpinAll()

isPinned

public boolean isPinned(Object key)

setPinned

public void setPinned(Object key,
                      boolean pinned)

size

public int size()
Specified by:
size in interface Map<K,V>

localSize

public int localSize()
Description copied from interface: DistributedCache
Get the number of elements local in the current node.

This number should always be less than size(), and is likely to be different as all cache entries are not required to be stored in the local heap.

Specified by:
localSize in interface DistributedCache<K,V>
Returns:
The local size, in range, such that 0 < localSize < size

shutdown

public void shutdown()
Description copied from interface: DistributedCache
Shut down the background eviction thread, if any.

Specified by:
shutdown in interface DistributedCache<K,V>

evictExpiredLocalElements

public void evictExpiredLocalElements()
Description copied from interface: Evictable
Trigger to walk through the local elements, look for expired elements, and evict them.

Specified by:
evictExpiredLocalElements in interface Evictable<K>

evictOrphanElements

public void evictOrphanElements(ClusterInfo clusterInfo)
Description copied from interface: Evictable
Trigger to walk through the specified set of orphaned elements, check whether they have expired, and evict them from the store.

Specified by:
evictOrphanElements in interface Evictable<K>
Parameters:
clusterInfo - The Terracotta cluster info which can be used to obtain the orphaned element list

invalidateCacheEntries

protected void invalidateCacheEntries(Iterator<K> keys)

getEvictRemoveCallback

protected MutationCallback<K,TimestampedValue<V>> getEvictRemoveCallback()

evicted

public void evicted(Object key,
                    Object value)
Description copied from interface: CacheEvictionListener
Method called when elements are evicted.

Value may be null (e.g. with server map, for cases when eviction happened in L2 and L1 has no value associated with the key)

Specified by:
evicted in interface CacheEvictionListener

onEvict

protected void onEvict(K key,
                       TimestampedValue<V> entry)
Used to notify listeners of eviction.

By the time this function is called, the item has already been evicted


onExpiry

protected void onExpiry(K key,
                        TimestampedValue<V> entry)
Used to notify listeners of expiry.

By the time this function is called, the item has already been expired


setTimeSource

public 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. If it's not called, SystemTimeSource is used which just calls System.currentTimeMillis(). Method public for tests in other projects

Parameters:
timeSource - The alternate TimeSource implementation

getTimeSource

public TimeSource getTimeSource()
Return the time source used by this cache to generate entry timestamps.

Returns:
this cache's timesource

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>

putNoReturn

public void putNoReturn(K key,
                        V value)
Description copied from interface: DistributedCache
Put the key/value into the map, replacing the existing value if present.

This method differs from the normal put() method only in that it returns void instead of the prior value. This is important in the cluster as it avoids faulting that value to return when it is rarely used.

Specified by:
putNoReturn in interface DistributedCache<K,V>
Parameters:
key - Key
value - Value

unlockedPutNoReturn

public void unlockedPutNoReturn(K key,
                                V value)
Description copied from interface: IncoherentDistributedCache
Same as DistributedCache.putNoReturn(Object, Object) except that this operation is performed without any locking.

Specified by:
unlockedPutNoReturn in interface IncoherentDistributedCache<K,V>

unlockedPutNoReturnWithCallback

public void unlockedPutNoReturnWithCallback(K key,
                                            V value,
                                            MutationCallback<K,TimestampedValue<V>> callback)

unlockedReplaceNoReturn

public void unlockedReplaceNoReturn(K key,
                                    V currentValue,
                                    V newValue)
Description copied from interface: IncoherentDistributedCacheInternals
Same as DistributedCache.putNoReturn(Object, Object) except that this operation is performed without any locking and puts in the cache only if there is already a mapping for key that is equal to currentValue

Specified by:
unlockedReplaceNoReturn in interface IncoherentDistributedCacheInternals<K,V>

unlockedReplaceNoReturnWithCallback

public void unlockedReplaceNoReturnWithCallback(K key,
                                                V currentValue,
                                                V newValue,
                                                MutationCallback<K,TimestampedValue<V>> callback)

unlockedRemoveNoReturn

public void unlockedRemoveNoReturn(K key,
                                   V currentValue)
Description copied from interface: IncoherentDistributedCacheInternals
Same as DistributedCache.removeNoReturn(Object) except this operation is performed without any locking and the remove is performed only when a current mapping exists and is equal to currentValue

Specified by:
unlockedRemoveNoReturn in interface IncoherentDistributedCacheInternals<K,V>

unlockedRemoveNoReturnWithCallback

public void unlockedRemoveNoReturnWithCallback(K key,
                                               V currentValue,
                                               MutationCallback<K,TimestampedValue<V>> callback)

unlockedPutIfAbsentNoReturn

public void unlockedPutIfAbsentNoReturn(K key,
                                        V value)
Description copied from interface: IncoherentDistributedCacheInternals
Same as ConcurrentMap.putIfAbsent(Object, Object) except this operation is performed without any locking and the is performed only when a current mapping exists and is equal to currentValue

Specified by:
unlockedPutIfAbsentNoReturn in interface IncoherentDistributedCacheInternals<K,V>

unlockedPutIfAbsentNoReturnWithCallback

public void unlockedPutIfAbsentNoReturnWithCallback(K key,
                                                    V value,
                                                    MutationCallback<K,TimestampedValue<V>> callback)

unsafeGet

public V unsafeGet(K key,
                   boolean quiet)
Description copied from interface: IncoherentDistributedCache
Returns the local value present for the key if present in the VM, otherwise returns null.

If the value is not present in the local VM, it WILL NOT fault in the value from the server even when it is present on the server and will return null instead

Note: If quiet is true, it may return expired entries

Specified by:
unsafeGet in interface IncoherentDistributedCache<K,V>
Parameters:
key - key to lookup
quiet - if true, does not update last access time and skips checking for expired entries otherwise updates last access time and also checks for expired entries
Returns:
the local value, if present in the VM, otherwise null

unsafeGetTimestampedValue

public TimestampedValue<V> unsafeGetTimestampedValue(K key,
                                                     boolean quiet)
Description copied from interface: IncoherentDistributedCache
Same as IncoherentDistributedCache.unsafeGet(Object, boolean) except returns the TimestampedValue instead of the original value

Specified by:
unsafeGetTimestampedValue in interface IncoherentDistributedCache<K,V>
Returns:

unlockedGet

public V unlockedGet(K key,
                     boolean quiet)
Description copied from interface: IncoherentDistributedCache
Same as Map.get(Object) except this operation is performed without any locking

This operation may fault in the value from the server if it is not present in the VM locally but present in the server

Specified by:
unlockedGet in interface IncoherentDistributedCache<K,V>
Returns:

unlockedGetTimestampedValue

public TimestampedValue<V> unlockedGetTimestampedValue(K key,
                                                       boolean quiet)
Description copied from interface: IncoherentDistributedCache
Same as IncoherentDistributedCache#unlockedGet(Object) except returns the TimestampedValue instead of the original value

Specified by:
unlockedGetTimestampedValue in interface IncoherentDistributedCache<K,V>
Returns:

unlockedGetAllTimestampedValue

public Map<K,TimestampedValue<V>> unlockedGetAllTimestampedValue(Set<K> keys,
                                                                 boolean quiet)

unlockedContainsKey

public boolean unlockedContainsKey(Object key)
Description copied from interface: IncoherentDistributedCache
Same as Map.containsKey(Object) except this operation is performed without any locking

Specified by:
unlockedContainsKey in interface IncoherentDistributedCache<K,V>
Returns:

removeNoReturn

public void removeNoReturn(Object key)
Description copied from interface: DistributedCache
Remove the key from the map, if it exists.

This method differs from the normal remove() method only in that it returns void instead of the prior value. This is important in the cluster as it avoids faulting that value to return it when it is rarely used.

Specified by:
removeNoReturn in interface DistributedCache<K,V>
Parameters:
key - Key

removeNoReturnWithCallback

public void removeNoReturnWithCallback(K key,
                                       MutationCallback<K,TimestampedValue<V>> callback)

unlockedRemoveNoReturn

public void unlockedRemoveNoReturn(Object key)
Description copied from interface: IncoherentDistributedCache
Same as DistributedCache.removeNoReturn(Object) except this operation is performed without any locking

Specified by:
unlockedRemoveNoReturn in interface IncoherentDistributedCache<K,V>

unlockedRemoveNoReturnWithCallback

public void unlockedRemoveNoReturnWithCallback(K key,
                                               MutationCallback<K,TimestampedValue<V>> callback)

isStatisticsEnabled

public boolean isStatisticsEnabled()
Description copied from interface: Evictable
Returns whether statistics are enabled.

Specified by:
isStatisticsEnabled in interface Evictable<K>
Returns:
true when statistics are enabled; and false otherwise

setStatisticsEnabled

public void setStatisticsEnabled(boolean enabled)
Description copied from interface: Evictable
Toggle statistics being enabled or not. When statistics are disabled, the already accumulated data will be reset.

Specified by:
setStatisticsEnabled in interface Evictable<K>
Parameters:
enabled - true to enable statistics; and false to disable them

getStatistics

public EvictionStatistics getStatistics()
Description copied from interface: Evictable
Retrieve the statistics for the current JVM.

Specified by:
getStatistics in interface Evictable<K>
Returns:
the statistics instance for the current JVM, statistics aren't shared across the cluster

getConfig

public CacheConfig getConfig()
Description copied from interface: DistributedCache
Get the current config for the cache.

This may or may not be the same config object as was orignally supplied to the cache.

Specified by:
getConfig in interface DistributedCache<K,V>
Returns:
The configuration for this cache

isEvictionEnabled

protected boolean isEvictionEnabled()

isCapacityEvictionEnabled

protected boolean isCapacityEvictionEnabled()

remove

public boolean remove(Object key,
                      Object value)
Specified by:
remove in interface ConcurrentMap<K,V>

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Specified by:
replace in interface ConcurrentMap<K,V>

getNodesWithKeys

public Map<K,Set<ClusterNode>> getNodesWithKeys(Collection<? extends K> keys)

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<K,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K,V>

putAll

public void putAll(Map<? extends K,? extends V> t)
Specified by:
putAll in interface Map<K,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>

createFinegrainedLock

public ClusteredLock createFinegrainedLock(K key)
Description copied from interface: LockableMap
Obtain a fine-grained lock instance for a particular key.

Specified by:
createFinegrainedLock in interface LockableMap<K>
Parameters:
key - the key for which a fine-grained lock has to be constructed
Returns:
an instance of fine-grained lock that can be used to perform primitive locking operations on a key

lockEntry

public void lockEntry(K key)
Description copied from interface: LockableMap
Lock the entry corresponding to this key.

Specified by:
lockEntry in interface LockableMap<K>
Parameters:
key - the key for which all entry accesses have to be locked

unlockEntry

public void unlockEntry(K key)
Description copied from interface: LockableMap
Unlock the entry corresponding to this key

Specified by:
unlockEntry in interface LockableMap<K>
Parameters:
key - the key for which all entry accesses have to be unlocked

putNoReturnWithCallback

public void putNoReturnWithCallback(K key,
                                    V value,
                                    MutationCallback<K,TimestampedValue<V>> callback)

clearWithCallback

public void clearWithCallback(MutationCallback<K,TimestampedValue<V>> callback)

localOnHeapSizeInBytes

public long localOnHeapSizeInBytes()
Specified by:
localOnHeapSizeInBytes in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

localOffHeapSizeInBytes

public long localOffHeapSizeInBytes()
Specified by:
localOffHeapSizeInBytes in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

localOnHeapSize

public int localOnHeapSize()
Specified by:
localOnHeapSize in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

localOffHeapSize

public int localOffHeapSize()
Specified by:
localOffHeapSize in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

initializeLocalCache

public void initializeLocalCache()
Specified by:
initializeLocalCache in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

destroyLocalCache

public void destroyLocalCache()
Specified by:
destroyLocalCache in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

containsKeyLocalOnHeap

public boolean containsKeyLocalOnHeap(Object key)
Specified by:
containsKeyLocalOnHeap in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

containsKeyLocalOffHeap

public boolean containsKeyLocalOffHeap(Object key)
Specified by:
containsKeyLocalOffHeap in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

setTargetMaxTotalCount

public void setTargetMaxTotalCount(int targetMaxTotalCount)

setMaxTTI

public void setMaxTTI(int maxTTI)

setMaxTTL

public void setMaxTTL(int maxTTL)

setMaxEntriesLocalHeap

public void setMaxEntriesLocalHeap(int maxEntriesLocalHeap)
Specified by:
setMaxEntriesLocalHeap in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

setMaxBytesLocalHeap

public void setMaxBytesLocalHeap(long maxBytesLocalHeap)
Specified by:
setMaxBytesLocalHeap in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

setLocalCacheEnabled

public void setLocalCacheEnabled(boolean enabled)
Specified by:
setLocalCacheEnabled in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

recalculateLocalCacheSize

public void recalculateLocalCacheSize(Object key)
Specified by:
recalculateLocalCacheSize in interface com.terracotta.toolkit.collections.InternalLocallyCacheable

markUsed

public void markUsed(K key,
                     Object entry,
                     int now)


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.