public class RandomPolicy extends Object implements EvictionPolicy
Constructor and Description |
---|
RandomPolicy() |
Modifier and Type | Method and Description |
---|---|
boolean |
accessOrder()
Defines if element access can alter the ordering of elements in the
underlying cache.
|
ConcurrentLinkedHashMapPro.Entry<?,?> |
evictElement(ConcurrentLinkedHashMapPro.Entry<?,?> head)
This method will be invoked by the underlying cache implementation when a
entry insertion is generated.
|
boolean |
insertionOrder()
Defines if element insertion can alter the ordering of elements in
the underlying cache.
|
ConcurrentLinkedHashMapPro.Entry<?,?> |
recordAccess(ConcurrentLinkedHashMapPro.Entry<?,?> head,
ConcurrentLinkedHashMapPro.Entry<?,?> accessedEntry)
This method will be invoked by the underlying cache implementation when a
entry access is generated.
|
ConcurrentLinkedHashMapPro.Entry<?,?> |
recordInsertion(ConcurrentLinkedHashMapPro.Entry<?,?> head,
ConcurrentLinkedHashMapPro.Entry<?,?> insertedEntry)
This method will be invoked by the underlying cache implementation when a
entry insertion is generated.
|
public RandomPolicy()
public boolean accessOrder()
EvictionPolicy
Invoking the get cache method results in an access to the corresponding entry (assuming it exists after the invocation completes). No other methods generate entry accesses. In particular, operations on collection-views do not affect the order of iteration of the backing cache.
accessOrder
in interface EvictionPolicy
public boolean insertionOrder()
EvictionPolicy
Invoking the put cache method results in an insertion of the corresponding entry. The putAll method generates one entry insertion for each mapping in the specified map, in the order that key-value mappings are provided by the specified map's entry set iterator. No other methods generate entry insertions.
insertionOrder
in interface EvictionPolicy
public ConcurrentLinkedHashMapPro.Entry<?,?> evictElement(ConcurrentLinkedHashMapPro.Entry<?,?> head)
EvictionPolicy
evictElement
in interface EvictionPolicy
head
- the head of the double linked list of all elements in cachepublic ConcurrentLinkedHashMapPro.Entry<?,?> recordInsertion(ConcurrentLinkedHashMapPro.Entry<?,?> head, ConcurrentLinkedHashMapPro.Entry<?,?> insertedEntry)
EvictionPolicy
This method has no effect if EvictionPolicy.insertionOrder()
method is implemented
to return false, whereas the newly inserted element will be placed at the end
(just before the head) of the cache's double linked element list.
recordInsertion
in interface EvictionPolicy
head
- the head of the double linked list of all elements in cacheinsertedEntry
- the cache entry that is insertedpublic ConcurrentLinkedHashMapPro.Entry<?,?> recordAccess(ConcurrentLinkedHashMapPro.Entry<?,?> head, ConcurrentLinkedHashMapPro.Entry<?,?> accessedEntry)
EvictionPolicy
This method has no effect if EvictionPolicy.accessOrder()
method is implemented
to return false.
recordAccess
in interface EvictionPolicy
head
- the head of the double linked list of all elements in cacheCopyright © 2015 Lucee