org.apache.jcs.engine.behavior
Interface IElementAttributes

All Known Implementing Classes:
ElementAttributes

public interface IElementAttributes

Interface for cache element attributes classes. Every item is the cache is associated with an element attributes object. It is used to track the life of the object as well as to restrict its behavior. By default, elements get a clone of the region's attributes.


Method Summary
 void addElementEventHandler(IElementEventHandler eventHandler)
          Adds a ElementEventHandler.
 void addElementEventHandlers(java.util.ArrayList eventHandlers)
          Sets the eventHandlers of the IElementAttributes object
 IElementAttributes copy()
          Returns a copy of the object.
 long getCreateTime()
          Gets the createTime attribute of the IAttributes object.
 java.util.ArrayList getElementEventHandlers()
          Gets the elementEventHandlers.
 long getIdleTime()
          Gets the idleTime attribute of the IAttributes object
 boolean getIsEternal()
          This turns off expiration if it is true.
 boolean getIsLateral()
          Is this item laterally distributable.
 boolean getIsRemote()
          Can this item be sent to the remote cache.
 boolean getIsSpool()
          Can this item be spooled to disk
 long getLastAccessTime()
          Gets the LastAccess attribute of the IAttributes object.
 long getMaxLifeSeconds()
          Sets the maxLife attribute of the IAttributes object.
 int getSize()
          Gets the size attribute of the IAttributes object
 long getTimeToLiveSeconds()
          Gets the time left to live of the IAttributes object.
 void setIdleTime(long idle)
          Sets the idleTime attribute of the IAttributes object.
 void setIsEternal(boolean val)
          Sets the isEternal attribute of the IElementAttributes object
 void setIsLateral(boolean val)
          Sets the isLateral attribute of the IElementAttributes object
 void setIsRemote(boolean val)
          Sets the isRemote attribute of the IElementAttributes object.
 void setIsSpool(boolean val)
          Sets the isSpool attribute of the IElementAttributes object
 void setLastAccessTimeNow()
          Sets the LastAccessTime as now of the IElementAttributes object
 void setMaxLifeSeconds(long mls)
          Sets the maxLife attribute of the IAttributes object.
 void setSize(int size)
          Size in bytes.
 

Method Detail

setMaxLifeSeconds

void setMaxLifeSeconds(long mls)
Sets the maxLife attribute of the IAttributes object.

Parameters:
mls - The new MaxLifeSeconds value

getMaxLifeSeconds

long getMaxLifeSeconds()
Sets the maxLife attribute of the IAttributes object. How many seconds it can live after creation.

If this is exceeded the element will not be returned, instead it will be removed. It will be removed on retrieval, or removed actively if the memory shrinker is turned on.

Returns:
The MaxLifeSeconds value

setIdleTime

void setIdleTime(long idle)
Sets the idleTime attribute of the IAttributes object. This is the maximum time the item can be idle in the cache, that is not accessed.

If this is exceeded the element will not be returned, instead it will be removed. It will be removed on retrieval, or removed actively if the memory shrinker is turned on.

Parameters:
idle - The new idleTime value

setSize

void setSize(int size)
Size in bytes. This is not used except in the admin pages. It will be -1 by default.

Parameters:
size - The new size value

getSize

int getSize()
Gets the size attribute of the IAttributes object

Returns:
The size value

getCreateTime

long getCreateTime()
Gets the createTime attribute of the IAttributes object.

This should be the current time in milliseconds returned by the sysutem call when the element is put in the cache.

Putting an item in the cache overrides any existing items.

Returns:
The createTime value

getLastAccessTime

long getLastAccessTime()
Gets the LastAccess attribute of the IAttributes object.

Returns:
The LastAccess value.

setLastAccessTimeNow

void setLastAccessTimeNow()
Sets the LastAccessTime as now of the IElementAttributes object


getIdleTime

long getIdleTime()
Gets the idleTime attribute of the IAttributes object

Returns:
The idleTime value

getTimeToLiveSeconds

long getTimeToLiveSeconds()
Gets the time left to live of the IAttributes object.

This is the (max life + create time) - current time.

Returns:
The TimeToLiveSeconds value

copy

IElementAttributes copy()
Returns a copy of the object.

Returns:
IElementAttributes

getIsSpool

boolean getIsSpool()
Can this item be spooled to disk

By default this is true.

Returns:
The spoolable value

setIsSpool

void setIsSpool(boolean val)
Sets the isSpool attribute of the IElementAttributes object

By default this is true.

Parameters:
val - The new isSpool value

getIsLateral

boolean getIsLateral()
Is this item laterally distributable. Can it be sent to auxiliaries of type lateral.

By default this is true.

Returns:
The isLateral value

setIsLateral

void setIsLateral(boolean val)
Sets the isLateral attribute of the IElementAttributes object

By default this is true.

Parameters:
val - The new isLateral value

getIsRemote

boolean getIsRemote()
Can this item be sent to the remote cache.

By default this is true.

Returns:
The isRemote value

setIsRemote

void setIsRemote(boolean val)
Sets the isRemote attribute of the IElementAttributes object.

By default this is true.

Parameters:
val - The new isRemote value

getIsEternal

boolean getIsEternal()
This turns off expiration if it is true.

Returns:
The IsEternal value

setIsEternal

void setIsEternal(boolean val)
Sets the isEternal attribute of the IElementAttributes object

Parameters:
val - The new isEternal value

addElementEventHandler

void addElementEventHandler(IElementEventHandler eventHandler)
Adds a ElementEventHandler. Handler's can be registered for multiple events. A registered handler will be called at every recognized event.

Parameters:
eventHandler - The feature to be added to the ElementEventHandler

getElementEventHandlers

java.util.ArrayList getElementEventHandlers()
Gets the elementEventHandlers.

Event handlers are transient. The only events defined are in memory events. All handlers are lost if the item goes to disk.

Returns:
The elementEventHandlers value, null if there are none

addElementEventHandlers

void addElementEventHandlers(java.util.ArrayList eventHandlers)
Sets the eventHandlers of the IElementAttributes object

Parameters:
eventHandlers - value


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.