org.deltava.util.cache
Class AgingCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.AgingCache<T>
public class AgingCache<T extends Cacheable>
- extends Cache<T>
An object cache that supports creation dates. The major difference between this cache and a ExpiringCache is
that this cache does not purge an entry until the cache overflows, whereas an ExpiringCache invalidates data
based on age.
- Since:
- 1.0
- Version:
- 3.1
- Author:
- Luke
| Fields inherited from class org.deltava.util.cache.Cache |
_cache |
|
Constructor Summary |
AgingCache(int maxSize)
Creates a new aging cache. |
|
Method Summary |
protected void |
addEntry(T obj)
Adds an entry to the cache. |
protected void |
addNullEntry(Object key)
Adds a null entry to the cache. |
T |
get(Object key)
Returns an entry from the cache. |
| Methods inherited from class org.deltava.util.cache.Cache |
add, addAll, addNull, checkOverflow, clear, contains, getHits, getMaxSize, getRequests, hit, remove, request, setMaxSize, size |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_lastCreationTime
protected long _lastCreationTime
AgingCache
public AgingCache(int maxSize)
- Creates a new aging cache.
- Parameters:
maxSize - the maximum size of the cache
- Throws:
IllegalArgumentException - if maxSize is zero or negative- See Also:
Cache.setMaxSize(int)
addEntry
protected void addEntry(T obj)
- Adds an entry to the cache.
- Specified by:
addEntry in class Cache<T extends Cacheable>
- Parameters:
obj - the entry to add to the cache
addNullEntry
protected void addNullEntry(Object key)
- Adds a null entry to the cache.
- Specified by:
addNullEntry in class Cache<T extends Cacheable>
- Parameters:
key - the entry key
get
public T get(Object key)
- Returns an entry from the cache.
- Specified by:
get in class Cache<T extends Cacheable>
- Parameters:
key - the cache key
- Returns:
- the cache entry, or null if not present
Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.