com.easyjf.cache.store
Class LruMemoryStore

java.lang.Object
  extended bycom.easyjf.cache.store.MemoryStore
      extended bycom.easyjf.cache.store.LruMemoryStore
All Implemented Interfaces:
Store

public class LruMemoryStore
extends MemoryStore

An implementation of a LruMemoryStore.

This uses LinkedHashMap as its backing map. It uses the LinkedHashMap LRU feature. LRU for this implementation means least recently accessed.

Version:
$Id: LruMemoryStore.java,v 1.8 2005/10/14 02:12:58 gregluck Exp $
Author:
Greg Luck

Nested Class Summary
 class LruMemoryStore.SpoolingLinkedHashMap
          An extension of LinkedHashMap which overrides #removeEldestEntry to persist cache entries to the auxiliary cache before they are removed.
 class LruMemoryStore.SpoolingLRUMap
          An LRU Map implementation based on Apache Commons LRUMap.
 
Constructor Summary
LruMemoryStore(ICache cache)
          Constructor for the LruMemoryStore object The backing LinkedHashMap is created with LRU by access order.
 
Method Summary
 java.util.Map loadMapInstance()
          Tries to load a LinkedHashMap (JDK1.4) and then tries to load an LRUMap.
 
Methods inherited from class com.easyjf.cache.store.MemoryStore
containsKey, create, dispose, get, getKeyArray, getKeySet, getQuiet, getSize, getSizeInBytes, getStatus, put, remove, removeAll, removeElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LruMemoryStore

public LruMemoryStore(ICache cache)
Constructor for the LruMemoryStore object The backing LinkedHashMap is created with LRU by access order.

Method Detail

loadMapInstance

public java.util.Map loadMapInstance()
                              throws CacheException
Tries to load a LinkedHashMap (JDK1.4) and then tries to load an LRUMap.

This way applications running JDK1.4 do not have a dependency on Apache commons-collections.

Returns:
a Map, being either LinkedHashMap or
Throws:
CacheException