Class AgingCache<T extends Cacheable>
java.lang.Object
org.deltava.util.cache.Cache<T>
org.deltava.util.cache.AgingCache<T>
- Type Parameters:
T- the Cacheable object type
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:
- 7.2
- Author:
- Luke
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAgingCache.AgingCacheEntry<U extends T>A cache entry for Aging caches.protected classAgingCache.AgingNullCacheEntry<U extends T>A null cache entry for Aging caches. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Cache
add, addAll, addNull, checkOverflow, clear, contains, getAll, getErrors, getHits, getMaxSize, getRequests, hit, isRemote, remove, request, setMaxSize, sizeModifier and TypeMethodDescriptionfinal voidAdds an entry to the cache.voidaddAll(Collection<? extends T> entries) Adds a number of entries to the cache.final voidAdds a null entry to the cache.protected voidAutomatically resizes the cache in the case of an overflow.voidclear()Clears the cache.booleanReturns if the cache contains a particular cache key.getAll(Collection<?> keys) Returns multiple objects from the cache.longReturns the total number of cache errors.final longgetHits()Returns the total number of cache hits.intReturns the maximum size of the cache.final longReturns the total number of cache requests.protected voidhit()Log a cache hit.booleanisRemote()Returns if the cache is a remote cache.voidInvalidate a cache entry.protected voidrequest()Log a cache request.final voidsetMaxSize(int size) Sets the maximum size of the cache.intsize()Returns the current size of the cache.
-
Field Details
-
_lastCreationTime
protected long _lastCreationTime
-
-
Constructor Details
-
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:
-
-
Method Details
-
addEntry
-
addNullEntry
Adds a null entry to the cache.- Specified by:
addNullEntryin classCache<T extends Cacheable>- Parameters:
key- the entry key
-
get
-