org.infinispan.container
Class LRUSimpleDataContainer
java.lang.Object
org.infinispan.container.SimpleDataContainer
org.infinispan.container.FIFOSimpleDataContainer
org.infinispan.container.LRUSimpleDataContainer
- All Implemented Interfaces:
- Iterable<InternalCacheEntry>, DataContainer
@ThreadSafe
public class LRUSimpleDataContainer
- extends FIFOSimpleDataContainer
Based on the same techniques outlined in the SimpleDataContainer
, this implementation always forces the
collection of last used timestamps for entries. This means that ImmortalCacheEntry
and MortalCacheEntry
are never used, since only TransientCacheEntry
and TransientMortalCacheEntry
instances capture timestamps.
All gets, puts, etc are constant time operations.
Iteration incurs a O(N log(N)) cost since the timestamps are sorted first, and there is an added memory overhead in
temporary space to hold sorted references. When sorting, this implementation does not use the millisecond granularity
when ordering timestamps; instead it defaults to a 1-second granularity since the LRU ordering does not need to be
strict and the TimSort implementation used for sorting performs significantly better with minimal reordering offered
by a coarser granularity.
- Since:
- 4.0
- Author:
- Manik Surtani
Methods inherited from class org.infinispan.container.SimpleDataContainer |
clear, containsKey, entrySet, get, keySet, peek, purgeExpired, put, remove, size, successfulPut, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LRUSimpleDataContainer
public LRUSimpleDataContainer(int concurrencyLevel)
LRUSimpleDataContainer
public LRUSimpleDataContainer(int concurrencyLevel,
int timestampGranularity)
Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.