Class LRUSimpleDataContainer

  extended by org.infinispan.container.SimpleDataContainer
      extended by org.infinispan.container.FIFOSimpleDataContainer
          extended by org.infinispan.container.LRUSimpleDataContainer
All Implemented Interfaces:
Iterable<InternalCacheEntry>, DataContainer

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.

Manik Surtani

Constructor Summary
LRUSimpleDataContainer(int concurrencyLevel)
LRUSimpleDataContainer(int concurrencyLevel, int timestampGranularity)
Method Summary
Methods inherited from class org.infinispan.container.FIFOSimpleDataContainer
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

Constructor Detail


public LRUSimpleDataContainer(int concurrencyLevel)


public LRUSimpleDataContainer(int concurrencyLevel,
                              int timestampGranularity)

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.