IMC Epclient 5.0.3

at.spardat.enterprise.cache
Class ICacheDescriptor

java.lang.Object
  extended byat.spardat.enterprise.cache.ICacheDescriptor
Direct Known Subclasses:
TransparentCacheDescriptor

public abstract class ICacheDescriptor
extends java.lang.Object

This class provides information describing the caching behaviour of a named cache.

Author:
s2266

Field Summary
static int MILLIS_PER_HOUR
           
static int MILLIS_PER_MINUTE
           
static int MILLIS_PER_SECOND
           
 
Constructor Summary
ICacheDescriptor()
           
 
Method Summary
abstract  long getMaxAgeMillis()
          Returns the maximum time in milliseconds a cache entry should be accessible in the chache.
 int getMaxAgeSpreadPct()
          If the value provided by this method is not zero, the time a cache entry resides in the cache before it is beeing evicted is spread to a percentage around getMaxAgeMillis().
abstract  int getMaxSize()
          Returns the maximum number of cached entries in the described cache.
abstract  java.lang.String getName()
          Returns the name of the described cache.
abstract  boolean isTransparent()
          Returns true if the described cache is a transparent cache, which can load objects by the load method of this descriptor
abstract  java.lang.Object load(java.lang.Object key)
          This is the load method of a transparent cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLIS_PER_SECOND

public static final int MILLIS_PER_SECOND
See Also:
Constant Field Values

MILLIS_PER_MINUTE

public static final int MILLIS_PER_MINUTE
See Also:
Constant Field Values

MILLIS_PER_HOUR

public static final int MILLIS_PER_HOUR
See Also:
Constant Field Values
Constructor Detail

ICacheDescriptor

public ICacheDescriptor()
Method Detail

getName

public abstract java.lang.String getName()
Returns the name of the described cache.


isTransparent

public abstract boolean isTransparent()
Returns true if the described cache is a transparent cache, which can load objects by the load method of this descriptor


load

public abstract java.lang.Object load(java.lang.Object key)
This is the load method of a transparent cache. If the cache user calls lookup and the key isn't in the cache, this method is called to get the cacheable object for the key.

This method may be called in parallel from many threads. You must not access instance variables in this method.

Parameters:
key - the key for which a value should be loaded.
Returns:
the loaded object. Must not be null. If there are exceptions in the course of the load procedure, you must throw a RuntimeException.

getMaxAgeMillis

public abstract long getMaxAgeMillis()
Returns the maximum time in milliseconds a cache entry should be accessible in the chache. If this value is less than or equal to zero, there is no age limitation.


getMaxAgeSpreadPct

public int getMaxAgeSpreadPct()
If the value provided by this method is not zero, the time a cache entry resides in the cache before it is beeing evicted is spread to a percentage around getMaxAgeMillis(). Suppose, getMaxAgeMillis() provides 3600000 (one hour). Then a getMaxAgeSpreadPct-value of 10 percent denotes that the actual validity-duration of an entry is randomly choosen in the range [3600000-360000 ... 360000+360000]. Or more readable, the duration is equally distributed between 54 and 66 minutes.

The default implementation of this method is no spread at all.

Returns:
Spread in percents.

getMaxSize

public abstract int getMaxSize()
Returns the maximum number of cached entries in the described cache. If this value is less than or equal to zero, the described cache does not have a size limitation.


IMC Epclient 5.0.3