|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jcs.engine.memory.AbstractMemoryCache
org.apache.jcs.engine.memory.lru.LRUMemoryCache
public class LRUMemoryCache
A fast reference management system. The least recently used items move to the end of the list and get spooled to disk if the cache hub is configured to use a disk cache. Most of the cache bottelnecks are in IO. There are no io bottlenecks here, it's all about processing power.
Even though there are only a few adjustments necessary to maintain the double linked list, we might want to find a more efficient memory manager for large cache regions.
The LRUMemoryCache is most efficient when the first element is selected. The smaller the region, the better the chance that this will be the case. < .04 ms per put, p3 866, 1/10 of that per get
| Nested Class Summary | |
|---|---|
class |
LRUMemoryCache.IteratorWrapper
iteration aid |
class |
LRUMemoryCache.MapEntryWrapper
|
| Field Summary |
|---|
| Fields inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache |
|---|
attr, cache, cacheName, cattr, chunkSize, map, status |
| Constructor Summary | |
|---|---|
LRUMemoryCache()
|
|
| Method Summary | |
|---|---|
protected void |
addLast(CacheElement ce)
Adds a new node to the end of the link list. |
void |
dumpCacheEntries()
Dump the cache entries from first to list for debugging. |
void |
dumpMap()
Dump the cache map for debugging. |
int |
freeElements(int numberToFree)
This instructs the memory cache to remove the numberToFree according to its eviction policy. |
ICacheElement |
get(java.io.Serializable key)
Get an item from the cache |
java.util.Iterator |
getIterator()
Gets the iterator attribute of the LRUMemoryCache object |
java.lang.Object[] |
getKeyArray()
Get an Array of the keys for all elements in the memory cache |
ICacheElement |
getQuiet(java.io.Serializable key)
Get an item from the cache without affecting its last access time or position. |
IStats |
getStatistics()
This returns semi-structured information on the memory cache, such as the size, put count, hit count, and miss count. |
void |
initialize(CompositeCache hub)
For post reflection creation initialization. |
boolean |
remove(java.io.Serializable key)
Removes an item from the cache. |
void |
removeAll()
Remove all of the elements from both the Map and the linked list implementation. |
protected ICacheElement |
spoolLastElement()
This spools the last element in the LRU, if one exists. |
void |
update(ICacheElement ce)
Puts an item to the cache. |
| Methods inherited from class org.apache.jcs.engine.memory.AbstractMemoryCache |
|---|
dispose, getCacheAttributes, getCacheName, getCompositeCache, getGroupKeys, getSize, getStatus, setCacheAttributes, waterfal |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LRUMemoryCache()
| Method Detail |
|---|
public void initialize(CompositeCache hub)
initialize in interface IMemoryCacheinitialize in class AbstractMemoryCachehub -
public void update(ICacheElement ce)
throws java.io.IOException
If the max size is reached, an element will be put to disk.
update in interface IMemoryCacheupdate in class AbstractMemoryCachece - The cache element, or entry wrapper
java.io.IOException
protected ICacheElement spoolLastElement()
throws java.lang.Error
java.lang.Error
public int freeElements(int numberToFree)
throws java.io.IOException
numberToFree -
java.io.IOException
public ICacheElement getQuiet(java.io.Serializable key)
throws java.io.IOException
getQuiet in interface IMemoryCachegetQuiet in class AbstractMemoryCachekey - Identifies item to find
java.io.IOException
public ICacheElement get(java.io.Serializable key)
throws java.io.IOException
get in interface IMemoryCacheget in class AbstractMemoryCachekey - Identifies item to find
java.io.IOException
public boolean remove(java.io.Serializable key)
throws java.io.IOException
remove in interface IMemoryCacheremove in class AbstractMemoryCachekey -
java.io.IOException
public void removeAll()
throws java.io.IOException
removeAll in interface IMemoryCacheremoveAll in class AbstractMemoryCachejava.io.IOExceptionpublic java.util.Iterator getIterator()
getIterator in interface IMemoryCachegetIterator in class AbstractMemoryCachepublic java.lang.Object[] getKeyArray()
getKeyArray in interface IMemoryCachegetKeyArray in class AbstractMemoryCacheprotected void addLast(CacheElement ce)
ce - The feature to be added to the Lastpublic void dumpMap()
public void dumpCacheEntries()
public IStats getStatistics()
getStatistics in interface IMemoryCachegetStatistics in class AbstractMemoryCacheIMemoryCache.getStatistics()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||