org.infinispan.container
Class LRUDataContainer
java.lang.Object
org.infinispan.container.FIFODataContainer
org.infinispan.container.LRUDataContainer
- All Implemented Interfaces:
- Iterable<InternalCacheEntry>, DataContainer
public class LRUDataContainer
- extends FIFODataContainer
Based on the same techniques outlined in the FIFODataContainer
, this implementation
additionally unlinks and re-links entries at the tail whenever entries are visited (using a get()) or are updated
(a put() on an existing key).
Again, these are constant-time operations.
- Since:
- 4.0
- Author:
- Manik Surtani
Method Summary |
InternalCacheEntry |
get(Object k)
Retrieves a cached entry |
void |
put(Object k,
Object v,
long lifespan,
long maxIdle)
Puts an entry in the cache along with a lifespan and a maxIdle time |
protected void |
updateLinks(org.infinispan.container.FIFODataContainer.LinkedEntry le)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LRUDataContainer
public LRUDataContainer()
get
public InternalCacheEntry get(Object k)
- Description copied from interface:
DataContainer
- Retrieves a cached entry
- Specified by:
get
in interface DataContainer
- Overrides:
get
in class FIFODataContainer
- Parameters:
k
- key under which entry is stored
- Returns:
- entry, if it exists and has not expired, or null if not
put
public void put(Object k,
Object v,
long lifespan,
long maxIdle)
- Description copied from interface:
DataContainer
- Puts an entry in the cache along with a lifespan and a maxIdle time
- Specified by:
put
in interface DataContainer
- Overrides:
put
in class FIFODataContainer
- Parameters:
k
- key under which to store entryv
- value to storelifespan
- lifespan in milliseconds. -1 means immortal.maxIdle
- max idle time for which to store entry. -1 means forever.
updateLinks
protected final void updateLinks(org.infinispan.container.FIFODataContainer.LinkedEntry le)
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.