public final class LruMemoryStore.SpoolingLinkedHashMap extends LinkedHashMap
removeEldestEntry(java.util.Map.Entry)
to persist cache entries to the auxiliary cache before they are removed.
This implementation also provides LRU by access order.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
LruMemoryStore.SpoolingLinkedHashMap()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isPinned(Object key)
Check if the key is pinned
|
Object |
put(Object key,
Object value) |
protected boolean |
removeEldestEntry(Map.Entry eldest)
Returns true if this map should remove its eldest entry.
|
void |
setPinning(Object key,
boolean pinned)
Mark the key as pinned or not
|
void |
unpinAll()
unpin all pinned keys
|
clear, containsValue, get
clone, containsKey, entrySet, isEmpty, keySet, putAll, remove, size, values
equals, hashCode, toString
public LruMemoryStore.SpoolingLinkedHashMap()
public void setPinning(Object key, boolean pinned)
key
- the key to be pinned or notpinned
- true if the key should be pinned, false otherwisepublic boolean isPinned(Object key)
key
- the key to be checkedpublic void unpinAll()
protected final boolean removeEldestEntry(Map.Entry eldest)
removeEldestEntry
in class LinkedHashMap
eldest
- The least recently inserted entry in the map, or if
this is an access-ordered map, the least recently accessed
entry. This is the entry that will be removed it this
method returns true. If the map was empty prior
to the put or putAll invocation resulting
in this invocation, this will be the entry that was just
inserted; in other words, if the map contains a single
entry, the eldest entry is also the newest.Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.