|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.cache.CachedMapAdapter
org.norther.tammi.core.cache.DefaultCache
org.norther.tammi.core.cache.DefaultResourceCache
public class DefaultResourceCache
A default implementation of ResourceCache.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.cache.DefaultCache |
|---|
DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR |
| Fields inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter |
|---|
DEFAULT_EXPIRATION_SLEEP_INTERVAL, DEFAULT_EXPIRATION_TIME |
| Constructor Summary | |
|---|---|
DefaultResourceCache()
Constructs a new resource cache. |
|
DefaultResourceCache(int max)
Constructs a new resource cache with max expiration time. |
|
DefaultResourceCache(int max,
int def)
Constructs a new resource cache with max and default expiration times. |
|
DefaultResourceCache(int max,
int def,
int sleep)
Constructs a new resource cache with max and default expiration times and expiration sleep interval. |
|
DefaultResourceCache(int max,
int def,
int sleep,
int capacity)
Constructs a new resource cache with max and default expiration times, an expiration sleep interval and initial capacity. |
|
DefaultResourceCache(int max,
int def,
int sleep,
int capacity,
float loadFactor)
Constructs a new resource cache with max and default expiration times, an expiration sleep interval, initial capacity and load factor. |
|
| Method Summary | |
|---|---|
long |
getCheckInterval()
Gets the interval of checking validity of cached resources. |
Resource |
getResource(String key)
Gets the cached resource. |
String |
getResourceClassName()
Gets the name of the cached resource class to apply inside this cache. |
int |
getSizeLimit()
Gets the size limit for resources to be kept in the cache. |
Resource |
putResource(String key,
Object src)
Puts the specified object as a resource into the cache. |
Resource |
putResource(String key,
Object src,
int freq)
Puts the specified object with an expiration frequency as a resource into the cache. |
Resource |
removeResource(String key)
Removes the cached resource. |
void |
setCheckInterval(long msecs)
Gets the interval of checking validity of cached resources. |
void |
setResource(String key,
Resource res)
Sets the cached resource. |
void |
setResource(String key,
Resource res,
int freq)
Sets the cached resource with an expiration frequency. |
void |
setResourceClassName(String className)
Sets the name of the cached resource class to apply inside this cache. |
void |
setSizeLimit(int limit)
Sets a size limit for resources to be kept in the cache. |
| Methods inherited from class org.norther.tammi.core.cache.DefaultCache |
|---|
addNotificationListener, getMBeanDelegate, getNotificationInfo, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, setAllowExpired, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime, toString, unmanaged |
| Methods inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter |
|---|
add, add, clear, containsKey, containsValue, entrySet, equals, expire, expireAll, expireFraction, get, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getExpirationTimer, getMaxExpirationTime, getSwapOutHandler, hashCode, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, isEmpty, keySet, put, put, putAll, putIfAbsent, putIfAbsent, refresh, refresh, remove, remove, replace, replace, setAutoRefreshDeclined, setExpirationTimer, setSwapOutHandler, size, values |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 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.concurrent.ConcurrentMap |
|---|
putIfAbsent, remove, replace, replace |
| Methods inherited from interface java.util.Map |
|---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Constructor Detail |
|---|
public DefaultResourceCache()
public DefaultResourceCache(int max)
max - a max expiration time (0 = default, -1 = infinite).
public DefaultResourceCache(int max,
int def)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).
public DefaultResourceCache(int max,
int def,
int sleep)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).
public DefaultResourceCache(int max,
int def,
int sleep,
int capacity)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).capacity - an initial capacity.
public DefaultResourceCache(int max,
int def,
int sleep,
int capacity,
float loadFactor)
max - a max expiration time (0 = default, -1 = infinite).def - a default expiration time (0 = default, -1 = infinite).sleep - an expiration sleep interval (0 = default, -1 = infinite).capacity - an initial capacity.loadFactor - a load factor.| Method Detail |
|---|
public long getCheckInterval()
ResourceCache
getCheckInterval in interface ResourceCachepublic void setCheckInterval(long msecs)
ResourceCache
setCheckInterval in interface ResourceCachemsecs - the check interval in milliseconds (-1 = only once).public int getSizeLimit()
ResourceCache
getSizeLimit in interface ResourceCachepublic void setSizeLimit(int limit)
ResourceCache
setSizeLimit in interface ResourceCachelimit - a limit for a resource size in bytes (-1 = unlimited).public String getResourceClassName()
ResourceCache
getResourceClassName in interface ResourceCachepublic void setResourceClassName(String className)
ResourceCache
setResourceClassName in interface ResourceCacheclassName - the class name of the cached resource.public Resource getResource(String key)
ResourceCache
getResource in interface ResourceCachekey - the key of the cached resource.
public void setResource(String key,
Resource res)
ResourceCacheNote that the size limit is not applied.
setResource in interface ResourceCachekey - the key of the cached resource.res - the cached resource.
public void setResource(String key,
Resource res,
int freq)
ResourceCacheNote that the size limit is not applied.
setResource in interface ResourceCachekey - the key of the cached resource.res - the cached resource.freq - the expiration frequency.
public Resource putResource(String key,
Object src)
throws ConstructionException
ResourceCache
putResource in interface ResourceCachekey - the key of the cached object.src - the object to cache.
ConstructionException - if construction fails.
public Resource putResource(String key,
Object src,
int freq)
throws ConstructionException
ResourceCache
putResource in interface ResourceCachekey - the key of the cached object.src - the object to cache.freq - the expiration frequency.
ConstructionException - if construction fails.public Resource removeResource(String key)
ResourceCache
removeResource in interface ResourceCachekey - the key of the cached resource.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||