Oracle Application Server 10g Java Object Cache API Reference
10g(9.0.4)

B10388-01

oracle.ias.cache
Class CapacityPolicy

java.lang.Object
  |
  +--oracle.ias.cache.CapacityPolicy

public abstract class CapacityPolicy
extends java.lang.Object

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.

Since:
9.0.4

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
 boolean policy(java.lang.Object handle, oracle.ias.cache.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, oracle.ias.cache.AggregateStatus aggStatus, long currentTime, java.lang.Object newObjectHandle)
          An abstract method for controlling group and region capacity.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

UNKNOWN

public static final int UNKNOWN
Value returned by getType if the type of the cached object is unknown. This would indicate an internal error in the cache an should never happen
See Also:
Constant Field Values

MEMORY

public static final int MEMORY
Value returned by getType if the the cached object is resident in memory.
See Also:
Constant Field Values

DISK

public static final int DISK
Value returned by getType if the the cached object is resident on disk only.
See Also:
Constant Field Values
Constructor Detail

CapacityPolicy

public CapacityPolicy()
Method Detail

policy

public abstract boolean policy(java.lang.Object victimHandle,
                               oracle.ias.cache.AggregateStatus aggStatus,
                               long currentTime,
                               java.lang.Object newObjectHandle)
                        throws CacheException
An abstract method for controlling group and region capacity. The policy method allows the cache administrator or the application writer control over which objects are removed when the configured capacity of the group or region is reached.

The objects, new and old are available to this method as well as associated statics and the aggregate statics for the region or group.

Parameters:
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 region
currentTime - The current time in Milliseconds
newObjectHandle - 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.
Returns:
true if the victim can be removed from the cache, false otherwise
Throws:
CacheException - for any exception that occurs
Since:
9.0.4

policy

public boolean policy(java.lang.Object handle,
                      oracle.ias.cache.AggregateStatus aggStatus,
                      long CurrentTime)
               throws CacheException
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.

The object to be removed is available to this method as well as associated statics and the aggregate statics for the cache.

Parameters:
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 region
Returns:
true if the victim can be removed from the cache, false otherwise
Throws:
CacheException - for any exception that occurs
Since:
9.0.4

Oracle Application Server 10g Java Object Cache API Reference
10g(9.0.4)

B10388-01

Copyright © 2003 Oracle Corporation. All Rights Reserved.