Class ElementAttributes
- All Implemented Interfaces:
Serializable
,Cloneable
,IElementAttributes
- When the item is put into the cache, you can associate an element attributes object.
- If not attributes object is include when the element is put into the cache, then the default attributes for the region will be used.
- The element attributes can be reset. This effectively results in a retrieval followed by a put. Hence, this is the same as 1.
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionConstructor for the IElementAttributes objectprotected
Constructor for the IElementAttributes object -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElementEventHandler
(IElementEventHandler eventHandler) Adds a ElementEventHandler.void
addElementEventHandlers
(List<IElementEventHandler> eventHandlers) Sets the eventHandlers of the IElementAttributes object.clone()
Clone objectlong
Gets the createTime attribute of the IAttributes object.Gets the elementEventHandlers.long
Gets the idleTime attribute of the IAttributes object.boolean
You can turn off expiration by setting this to true.boolean
Is this item laterally distributable.boolean
Can this item be sent to the remote cacheboolean
Can this item be spooled to disklong
Gets the LastAccess attribute of the IAttributes object.long
Sets the maxLife attribute of the IAttributes object.int
getSize()
Gets the size attribute of the IAttributes objectlong
long
Gets the time left to live of the IAttributes object.void
Sets the createTime attribute of the IElementAttributes objectvoid
setIdleTime
(long idle) Sets the idleTime attribute of the IAttributes object.void
setIsEternal
(boolean val) Sets the isEternal attribute of the ElementAttributes object.void
setIsLateral
(boolean val) Sets the isLateral attribute of the IElementAttributes objectvoid
setIsRemote
(boolean val) Sets the isRemote attribute of the ElementAttributes objectvoid
setIsSpool
(boolean val) Sets the isSpool attribute of the IElementAttributes objectvoid
setLastAccessTime
(long time) only for use from test codevoid
Sets the LastAccessTime as now of the IElementAttributes objectvoid
setMaxLife
(long mls) Sets the maxLife attribute of the IAttributes object.void
setSize
(int size) Size in bytes.void
setTimeFactorForMilliseconds
(long factor) toString()
For logging and debugging the element IElementAttributes.
-
Constructor Details
-
ElementAttributes
public ElementAttributes()Constructor for the IElementAttributes object -
ElementAttributes
Constructor for the IElementAttributes object- Parameters:
attr
-
-
-
Method Details
-
setMaxLife
Sets the maxLife attribute of the IAttributes object.- Specified by:
setMaxLife
in interfaceIElementAttributes
- Parameters:
mls
- The new MaxLifeSeconds value
-
getMaxLife
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.
- Specified by:
getMaxLife
in interfaceIElementAttributes
- Returns:
- The MaxLifeSeconds value
-
setIdleTime
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.
- Specified by:
setIdleTime
in interfaceIElementAttributes
- Parameters:
idle
- The new idleTime value
-
setSize
Size in bytes. This is not used except in the admin pages. It will be 0 by default and is only updated when the element is serialized.- Specified by:
setSize
in interfaceIElementAttributes
- Parameters:
size
- The new size value
-
getSize
Gets the size attribute of the IAttributes object- Specified by:
getSize
in interfaceIElementAttributes
- Returns:
- The size value
-
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.
- Specified by:
getCreateTime
in interfaceIElementAttributes
- Returns:
- The createTime value
-
setCreateTime
Sets the createTime attribute of the IElementAttributes object -
getIdleTime
Gets the idleTime attribute of the IAttributes object.- Specified by:
getIdleTime
in interfaceIElementAttributes
- Returns:
- The idleTime value
-
getTimeToLiveSeconds
Gets the time left to live of the IAttributes object.This is the (max life + create time) - current time.
- Specified by:
getTimeToLiveSeconds
in interfaceIElementAttributes
- Returns:
- The TimeToLiveSeconds value
-
getLastAccessTime
Gets the LastAccess attribute of the IAttributes object.- Specified by:
getLastAccessTime
in interfaceIElementAttributes
- Returns:
- The LastAccess value.
-
setLastAccessTimeNow
Sets the LastAccessTime as now of the IElementAttributes object- Specified by:
setLastAccessTimeNow
in interfaceIElementAttributes
-
setLastAccessTime
only for use from test code -
getIsSpool
Can this item be spooled to diskBy default this is true.
- Specified by:
getIsSpool
in interfaceIElementAttributes
- Returns:
- The spoolable value
-
setIsSpool
Sets the isSpool attribute of the IElementAttributes objectBy default this is true.
- Specified by:
setIsSpool
in interfaceIElementAttributes
- Parameters:
val
- The new isSpool value
-
getIsLateral
Is this item laterally distributable. Can it be sent to auxiliaries of type lateral.By default this is true.
- Specified by:
getIsLateral
in interfaceIElementAttributes
- Returns:
- The isLateral value
-
setIsLateral
Sets the isLateral attribute of the IElementAttributes objectBy default this is true.
- Specified by:
setIsLateral
in interfaceIElementAttributes
- Parameters:
val
- The new isLateral value
-
getIsRemote
Can this item be sent to the remote cache- Specified by:
getIsRemote
in interfaceIElementAttributes
- Returns:
- true if the item can be sent to a remote auxiliary
-
setIsRemote
Sets the isRemote attribute of the ElementAttributes object- Specified by:
setIsRemote
in interfaceIElementAttributes
- Parameters:
val
- The new isRemote value
-
getIsEternal
You can turn off expiration by setting this to true. The max life value will be ignored.- Specified by:
getIsEternal
in interfaceIElementAttributes
- Returns:
- true if the item cannot expire.
-
setIsEternal
Sets the isEternal attribute of the ElementAttributes object. True means that the item should never expire. If can still be removed if it is the least recently used, and you are using the LRUMemory cache. it just will not be filtered for expiration by the cache hub.- Specified by:
setIsEternal
in interfaceIElementAttributes
- Parameters:
val
- The new isEternal value
-
addElementEventHandler
Adds a ElementEventHandler. Handler's can be registered for multiple events. A registered handler will be called at every recognized event.The alternative would be to register handlers for each event. Or maybe The handler interface should have a method to return whether it cares about certain events.
- Specified by:
addElementEventHandler
in interfaceIElementAttributes
- Parameters:
eventHandler
- The ElementEventHandler to be added to the list.
-
addElementEventHandlers
Sets the eventHandlers of the IElementAttributes object.This add the references to the local list. Subsequent changes in the caller's list will not be reflected.
- Specified by:
addElementEventHandlers
in interfaceIElementAttributes
- Parameters:
eventHandlers
- List of IElementEventHandler objects
-
getTimeFactorForMilliseconds
- Specified by:
getTimeFactorForMilliseconds
in interfaceIElementAttributes
-
setTimeFactorForMilliseconds
- Specified by:
setTimeFactorForMilliseconds
in interfaceIElementAttributes
-
getElementEventHandlers
Gets the elementEventHandlers. Returns null if none exist. Makes checking easy.- Specified by:
getElementEventHandlers
in interfaceIElementAttributes
- Returns:
- The elementEventHandlers List of IElementEventHandler objects
-
toString
For logging and debugging the element IElementAttributes. -
clone
Description copied from interface:IElementAttributes
Clone object- Specified by:
clone
in interfaceIElementAttributes
- Overrides:
clone
in classObject
- See Also:
-