org.norther.tammi.core.cache
Interface Cache<K,V>
- Type Parameters:
K
- the type of keys maintained by the cache.V
- the type of cached values.
- All Superinterfaces:
- CachedMap<K,V>, ConcurrentMap<K,V>, Map<K,V>
- All Known Subinterfaces:
- ResourceCache, SessionManager, SharedCache<K,V>
- All Known Implementing Classes:
- DefaultCache, DefaultResourceCache, DefaultSessionManager, DefaultSharedCache
public interface Cache<K,V>
- extends CachedMap<K,V>
Extends CachedMap
to adapt a cache supporting expiration of
old entries. The map has a default expiration time, which is used for objects
put into the map without an explicit expiration frequency. The maximum
expiration time specifies the longest possible expiration time for the map.
Its value may affect the performance of the map and should be realistic.
Expired entries are searched at regular intervals specified by the expiration
sleep interval. All times are given in seconds. The value -1 indicates always
infinite time.
The expiration time of an entry is automatically refreshed when it is got
from the map. However, iterators do not need to refresh entries accessed
through them.
The maximum number of entries accepted by the map can be specified with max
entries. The oldest entries above the limit will be expired indepently on
their expiration time. The limit need not to be strict during puts but
maintained by the expiration handler.
Note that the size of the map and its sets and collections is not constant in
time as entries expire dynamically. Iterators can return expired entries if
there is a pause between calls to the hasNext and next methods.
- Version:
- $Id: Cache.java,v 1.12 2009/09/28 15:08:43 cvsimp Exp $
- Author:
- Ilkka Priha
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from interface org.norther.tammi.acorn.cache.CachedMap |
add, add, expire, expireAll, expireFraction, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getMaxExpirationTime, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, put, putIfAbsent, refresh, refresh, setAllowExpired, setAutoRefreshDeclined, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Copyright © 2004 The Norther Organization. All rights reserved.