stamp.util
Class Cache
java.lang.Object
|
+--stamp.util.List
|
+--stamp.util.Pool
|
+--stamp.util.Cache
- public class Cache
- extends Pool
A cache is a special type of pool. When an attempt is made to check out a
new object when all objects are in use, the 'oldest' object is returned.
A least recently used algorithm is used to determine the oldest object.
Caution: the LRU algorithm doesn't wrap around correctly.
Constructor Summary |
Cache(int maxSize)
Creates a new cache with the specified number of entries. |
age
protected int[] age
globalAge
protected int globalAge
Cache
public Cache(int maxSize)
- Creates a new cache with the specified number of entries.
checkOut
public Object checkOut()
throws IndexOutOfBoundsException
- Check an object out of the pool.
- Overrides:
- checkOut in class Pool
- Returns:
- a free object instantance