|
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.Attributes
Attributes is used to define how an object should be managed by the cache. Each Object in the cache has attributes associate with it. See User's Guide about how each attribute affects the various object types.
Field Summary | |
static long |
ALLOWNULL indicates null values may be cached for this object or region. |
static long |
DISTRIBUTE indicates the object is distributed, updates and invalidations are distributed to other processes Default is local. |
static long |
GROUP_TTL_DESTROY indicates that the group object should be destroyed when the associated time to live expires. |
static long |
MEASURE indicates the object size should be calculated by the cache. |
static long |
ORIGINAL indicates the object was created by the application in the cache rather than loaded from an external source. the Original objects don't get removed from the cache when they are not referenced, they must be invalidated before they get removed from the cache. |
static long |
REPLY indicates a reply should be sent from remote caches if this object is updated or invalidated. |
static long |
SPOOL indicates the object should be spooled to disk when the object is being removed from the memory cache because of space limitations. |
static long |
SYNCHRONIZE indicates that updates to this object should be synchronized. |
static long |
SYNCHRONIZE_DEFAULT indicates that all objects in a group should be synchronized individually. |
Constructor Summary | |
Attributes() constructs a default Attributes. |
Method Summary | |
java.lang.Object |
clone() clones a new Attributes object. |
CapacityPolicy |
getCapacityPolicy() returns a CapacityPolicy object for this object or region |
java.lang.ClassLoader |
getClassLoader() get the ClassLoader attribute. |
long |
getCreateTime() returns the time the object was loaded into the cache. |
long |
getDefaultTimeToLive() returns the Default TimeToLive value in seconds as a long value. |
CacheEventListener |
getEventListener(int id) Return the registered event listener object based on the event id. |
long |
getFlags() returns all flags as defined in setFlags as a long value. |
long |
getIdleTime() returns the current value for the idle time interval. |
CacheLoader |
getLoader() returns a CacheLoader object from this Attribute. |
long |
getMaxCount() returns the current value for maxCount MaxCount is the maximum number of objects that can exist in a group or region. |
long |
getMaxSize() returns the current value for maxSize MaxSize is the maximum number of bytes this region or group can use. |
long |
getObjectSize() returns the size of the object which was specified by invoking setSize(long) . |
long |
getPriority() returns the current value for priority |
long |
getTimeToLive() returns the current value for the time to live interval. |
java.lang.Object |
getUserAttribute(java.lang.Object key) returns the specified user defined attribute |
long |
getVersion() returns the current value of version. |
boolean |
isSet(long vflags) returns true if the specified attribute is set, false otherwise. |
void |
setCacheEventListener(int id, CacheEventListener listener) registers an event listener object to be executed when the event occurs. |
void |
setCacheEventListener(int id, CacheEventListener listener, boolean def) registers an event listener object to be executed when the event occurs. |
void |
setCapacityPolicy(CapacityPolicy policy) sets a CapacityPolicy object for the object or region |
void |
setClassLoader(java.lang.ClassLoader aLoader) set a ClassLoader. |
void |
setDefaultTimeToLive(long sec) sets the default maximum time all objects associated with this group or region will stay in the cache before it is invalidated. |
void |
setFlags(long newFlags) specifies which of the listed attributes should be set in the Attributes object. |
void |
setFlagsToDefault() resets this Attributes object to contain default Attributes values. |
void |
setIdleTime(int idle) sets the maximum time the associated cache object will remain in the cache without being referenced before it is invalidated. |
void |
setLoader(CacheLoader loader) sets a CacheLoader object in this Attribute. |
void |
setMaxCount(int count) sets the maximum number of objects that can be associated with a region This attribute is ignored if set for individual objects |
void |
setMaxSize(long size) sets the maximum number of bytes that can be associated with a region This attribute is ignored if set for individual objects |
void |
setPriority(int priority) sets the priority associated with this cache object Priority is used to help determine which objects should be removed from the cache when the configured capacity of the cache or region is reached. |
void |
setSize(long objSize) sets the size of the object. |
void |
setTimeToLive(long sec) sets the maximum time the associated cache object will stay in the cache before it is invalidated. |
void |
setUserAttribute(java.lang.Object key, java.lang.Object value) allows the user to define applications specific attributes. |
void |
setVersion(long newversion) sets the version attribute. |
static long |
timeToSeconds(int days, int hours, int minutes, int seconds) converts the time specified in days, hours, minutes and seconds to seconds. |
java.lang.String |
toString() converts the Attributes object to a string of the form: flags, version, time to live, idle time. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final long DISTRIBUTE
public static final long REPLY
public static final long SYNCHRONIZE
public static final long SPOOL
public static final long GROUP_TTL_DESTROY
public static final long ORIGINAL
public static final long SYNCHRONIZE_DEFAULT
public static final long ALLOWNULL
By default a null is an invalid object in the cache. Attempting to cache a null value will generate an exception. This flag will override this restriction allowing nulls to be cached.
public static final long MEASURE
If the MEASURE flag is set, the size of an object is automatically calculated when the object is loaded into the cache. The size attributed is set to this size. This allows the cache and region size to be controlled by the object size (number of bytes) rather than the number of objects.
Constructor Detail |
public Attributes()
Method Detail |
public void setFlags(long newFlags)
Attributes.DISTRIBUTE|Attributes.SPOOL
. Any previous settings will be disregard.newFlags
- can be a combination of the following values:
public long getFlags()
public void setFlagsToDefault()
public void setVersion(long newversion)
newversion
- An user defined version number.public void setTimeToLive(long sec) throws InvalidArgumentException
timeToSeconds()
method may be used to convert days, hours, and/or minutes to seconds.sec
- Maximum time (in seconds) the associated cache object will stay in the cache before it is invalidated.InvalidArgumentException
- if a negative value is supplied for argument sec
.public void setDefaultTimeToLive(long sec) throws InvalidArgumentException
timeToSeconds()
method may be used to convert days, hours, and/or minutes to seconds.sec
- Maximum time (in seconds) the associated cache object will stay in the cache before it is invalidated.InvalidArgumentException
- if a negative value is supplied for argument sec
.public long getDefaultTimeToLive()
public void setIdleTime(int idle) throws InvalidArgumentException
idle
is in seconds. The timeToSeconds()
method may be used to convert days, hours, and/or minutes to seconds.idle
- Maximum time (in seconds) the associated cache object will remain in the cache without being referenced before it is invalidated.InvalidArgumentException
- if a negative value is supplied for argument idle
.public void setPriority(int priority)
priority
- priority associated with this cache objectpublic void setMaxCount(int count) throws InvalidArgumentException
count
- Maximum number of objects that can be associated with a regionInvalidArgumentException
- if a negative value is supplied for argument idle
.public void setMaxSize(long size) throws InvalidArgumentException
size
- Maximum number of bytes that can be associated with a regionInvalidArgumentException
- if a negative value is supplied for argument idle
.public void setCacheEventListener(int id, CacheEventListener listener) throws InvalidArgumentException
OBJECT_INVALIDATED
and OBJECT_UPDATED
are currently supported.id
- the id of the event to be handledlistener
- A CacheEventListener object.InvalidArgumentException
- if the event type (argument id
) is not CacheEvent.OBJECT_INVALIDATED
or CacheEvent.OBJECT_UPDATED
public void setCacheEventListener(int id, CacheEventListener listener, boolean def) throws InvalidArgumentException
OBJECT_INVALIDATED
and OBJECT_UPDATED
are currently supported. If the def
parameter is true then for groups and regions the event listener is associated with members of the group or region rather than the group or region itself. For individual objects the def
parameter is ignored.id
- the id of the event to be handledlistener
- A CacheEventListener object.def
- true if the handler should apply to the members of a group or region individually rather than the group or region itselfInvalidArgumentException
- if the event type (argument id
) is not CacheEvent.OBJECT_INVALIDATED
or CacheEvent.OBJECT_UPDATED
.public void setClassLoader(java.lang.ClassLoader aLoader)
public java.lang.ClassLoader getClassLoader()
public CacheEventListener getEventListener(int id)
id
- the id of the event to be handledpublic void setLoader(CacheLoader loader)
loader
- The CacheLoader object to be set in this Attribute.public void setCapacityPolicy(CapacityPolicy policy)
policy
- The CapacityPolicy object to be set in this Attribute.public void setSize(long objSize)
objSize
- is the size of the object in bytes.public void setUserAttribute(java.lang.Object key, java.lang.Object value) throws InvalidArgumentException
These user defined attributes are available to the user defined methods CacheLoader
, CapacityPolicy
and CacheEventListeners
through the getAttributes method associated with these objects.
key
- the key to identify the attributevalue
- the attribute to be storedInvalidArgumentException
public CacheLoader getLoader()
public CapacityPolicy getCapacityPolicy()
public boolean isSet(long vflags)
isSet()
will return true only if all of the attributes specifed are set.vflags
- Verify if a particular attribute is set.public long getVersion()
public long getCreateTime()
public long getTimeToLive()
public long getIdleTime()
public long getPriority()
public long getMaxCount()
MaxCount is the maximum number of objects that can exist in a group or region. Once this limit is reached an object must be removed before a new object can be places in the cache. To determine which object is removed, the capacityPolicy for the group or region will be invoked.
public long getMaxSize()
MaxSize is the maximum number of bytes this region or group can use. If the MEASURE
flag is set the size of objects in the cache will be calculated at the time the object is loaded into the cache. If this flag is not set, it is up to the user to set the object size using the setSize(long)
method. The maxSize attribute is only valid for regions and groups. It will be ignored if set on individual objects.
public long getObjectSize()
setSize(long)
.public java.lang.Object getUserAttribute(java.lang.Object key)
key
- The user attribute to look uppublic java.lang.Object clone()
public static long timeToSeconds(int days, int hours, int minutes, int seconds) throws InvalidArgumentException
days
- Number of days.hours
- Number of hours.minutes
- Number of minutes.seconds
- Number of seconds.InvalidArgumentException
- if a negative value is supplied for any of the arguments.public java.lang.String toString()
|
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 |