| java.lang.Object net.sf.ehcache.Element
Element | final public class Element implements Serializable,Cloneable(Code) | | A Cache Element, consisting of a key, value and attributes.
From ehcache-1.2, Elements can have keys and values that are Serializable or Objects. To preserve backward
compatibility, special accessor methods for Object keys and values are provided:
Element.getObjectKey() and
Element.getObjectValue() . If placing Objects in ehcache, developers must use the new getObject... methods to
avoid CacheExceptions. The get... methods are reserved for Serializable keys and values.
author: Greg Luck version: $Id: Element.java 525 2007-07-31 22:41:54Z gregluck $ |
Constructor Summary | |
public | Element(Serializable key, Serializable value, long version) A full constructor.
Creation time is set to the current time. | public | Element(Object key, Object value, long version) A full constructor.
Creation time is set to the current time. | public | Element(Object key, Object value, long version, long creationTime, long lastAccessTime, long nextToLastAccessTime, long lastUpdateTime, long hitCount) A full constructor. | public | Element(Serializable key, Serializable value) Constructor. | public | Element(Object key, Object value) Constructor. |
Method Summary | |
final public Object | clone() Clones an Element. | final public boolean | equals(Object object) Equals comparison with another element, based on the key. | final public long | getCreationTime() Gets the creationTime attribute of the ElementAttributes object. | public long | getExpirationTime() Returns the expiration time based on time to live. | final public long | getHitCount() Gets the hit count on this element. | final public Serializable | getKey() Gets the key attribute of the Element object.
The key value. | final public long | getLastAccessTime() Gets the last access time.
Access means a get. | public long | getLastUpdateTime() If there is an Element in the Cache and it is replaced with a new Element for the same key,
then both the version number and lastUpdateTime should be updated to reflect that. | final public long | getNextToLastAccessTime() Gets the next to last access time. | final public Object | getObjectKey() Gets the key attribute of the Element object.
This method is provided for those wishing to use ehcache as a memory only cache
and enables retrieval of non-Serializable values from elements.
The key as an Object. | final public Object | getObjectValue() Gets the value attribute of the Element object as an Object.
This method is provided for those wishing to use ehcache as a memory only cache
and enables retrieval of non-Serializable values from elements.
The value as an Object. | final public long | getSerializedSize() The size of this object in serialized form. | public int | getTimeToIdle() | public int | getTimeToLive() | final public Serializable | getValue() Gets the value attribute of the Element object.
The value which must be Serializable. | final public long | getVersion() Gets the version attribute of the ElementAttributes object. | final public int | |
|
|