|
Oracle Application Server Java Object Cache API Reference 10g Release 2 (10.1.2) B14018-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ias.cache.CapacityPolicy
CapacityPolicy is an abstract class. An application writer or cache administrator can extend this class to define the policy to use when choosing which object should be removed from the cache when the configured resource limit has been reached. A capacity policy can be associated with the cache or with a group or region within the cache. The policy associated with the cache may be different than that associated with a group or region. Which policy is invoked is dependent on which capacity is reached first, i.e., if the region reaches its limit the policy associated with the region will be invoked, if the cache limit is reached first the cache policy will be invoked.
For regions and groups, the capacity policy is invoked when an object is being loaded that will exceed the configured limit. Sufficient objects will be removed to make room for the new object or the object will not be loaded into the cache. The object will be returned to the user but marked as invalid so it will not be stored in the cache. For the cache, sufficient objects will be removed to maintain the configured buffer.
When a configured limit is reached in the cache the priority of the cached objects is first checked. For regions and groups, an object of lower priority will never replace an object of higher priority. Objects of higher priority are not presented to the capacity policy object for consideration. For the cache, lower priority objects are checked first, if sufficient space has not been freed, higher priority objects will be evaluated.
Field Summary | |
static int |
DISK Value returned by getType if the the cached object is resident on disk only. |
static int |
MEMORY Value returned by getType if the the cached object is resident in memory. |
static int |
UNKNOWN Value returned by getType if the type of the cached object is unknown. |
Constructor Summary | |
CapacityPolicy() |
Method Summary | |
protected Attributes |
getAttributes(java.lang.Object handle) returns the attributes associated with the handle |
protected java.lang.Object |
getName(java.lang.Object handle) returns the name associated with the handle |
protected java.lang.String |
getRegion(java.lang.Object handle) returns the region associated with the handle |
protected ObjectStatus |
getStatus(java.lang.Object handle) returns the object status associated with the handle |
protected int |
getType(java.lang.Object handle) returns the object type associated with the handle The possible values are MEMORY, DISK or UNKNOWN. |
boolean |
policy(java.lang.Object handle, AggregateStatus aggStatus, long CurrentTime) The policy method allows the cache administrator or the application writer control over which objects are removed when the configured capacity of the cache is reached. |
abstract boolean |
policy(java.lang.Object victimHandle, AggregateStatus aggStatus, long currentTime, java.lang.Object newObjectHandle) An abstract method for controlling group and region capacity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNKNOWN
public static final int MEMORY
public static final int DISK
Constructor Detail |
public CapacityPolicy()
Method Detail |
public abstract boolean policy(java.lang.Object victimHandle, AggregateStatus aggStatus, long currentTime, java.lang.Object newObjectHandle) throws CacheException
The objects, new and old are available to this method as well as associated statics and the aggregate statics for the region or group.
victimHandle
- An internal cache handle object, giving access to to information associated with the potential victim.aggStatus
- The aggregate status for the associated cache, group or regioncurrentTime
- The current time in MillisecondsnewObjectHandle
- An internal cache handle object, giving access to to information associated with the object being loaded. If the CapacityPolicy object is associated with the cache this will be null.CacheException
- for any exception that occurspublic boolean policy(java.lang.Object handle, AggregateStatus aggStatus, long CurrentTime) throws CacheException
The object to be removed is available to this method as well as associated statics and the aggregate statics for the cache.
handle
- An internal cache handle object, giving access to to information associated with the potential victim.aggStatus
- The aggregate status for the associated cache, group or regionCacheException
- for any exception that occursprotected final java.lang.Object getName(java.lang.Object handle)
handle
- An internal cache handle objectprotected final java.lang.String getRegion(java.lang.Object handle)
handle
- An internal cache handle objectprotected final Attributes getAttributes(java.lang.Object handle) throws CacheException
handle
- An internal cache handle objectCacheException
protected final ObjectStatus getStatus(java.lang.Object handle)
handle
- An internal cache handle objectprotected final int getType(java.lang.Object handle)
handle
- An internal cache handle object
|
Oracle Application Server Java Object Cache API Reference 10g Release 2 (10.1.2) B14018-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |