net.sf.spif.util
Class Cache
java.lang.Object
|
+--java.util.AbstractMap
|
+--java.util.HashMap
|
+--java.util.LinkedHashMap
|
+--net.sf.spif.util.Cache
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class Cache
- extends java.util.LinkedHashMap
A last-recently-used cache.
- Version:
- $Id: Cache.java,v 1.2 2003/02/05 22:15:51 bratseth Exp $
- Author:
- Jon S Bratseth
- See Also:
- Serialized Form
Constructor Summary |
Cache()
Creates a cache with the default size (10000) |
Cache(int cacheSize)
Creates a cache with a size |
Method Summary |
int |
getCacheSize()
Returns the maximum number of items in this cache |
void |
printContents()
Prints the contents of the cache for debugging |
protected boolean |
removeEldestEntry(java.util.Map.Entry eldest)
|
Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get |
Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Cache
public Cache()
- Creates a cache with the default size (10000)
Cache
public Cache(int cacheSize)
- Creates a cache with a size
getCacheSize
public int getCacheSize()
- Returns the maximum number of items in this cache
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry eldest)
- Overrides:
removeEldestEntry
in class java.util.LinkedHashMap
printContents
public void printContents()
- Prints the contents of the cache for debugging
Spif 1.01 (2003-04-03). http://spif.sf.net