net.sf.ehcache
Class Element

java.lang.Object
  extended bynet.sf.ehcache.Element
All Implemented Interfaces:
java.io.Serializable

public class Element
extends java.lang.Object
implements java.io.Serializable

A Cache Element, consisting of a key, value and attributes.

Version:
$Id: Element.java,v 1.9 2003/12/04 05:39:11 gregluck Exp $
Author:
Greg Luck
See Also:
Serialized Form

Constructor Summary
Element(java.io.Serializable key, java.io.Serializable value)
          Constructor
Element(java.io.Serializable key, java.io.Serializable value, long version)
          A full constructor.
 
Method Summary
 long getCreationTime()
          Gets the creationTime attribute of the ElementAttributes object
 long getHitCount()
          Gets the hit count on this element.
 java.io.Serializable getKey()
          Gets the key attribute of the Element object
 long getLastAccessTime()
          Gets the last access time.
 java.io.Serializable getValue()
          Gets the value attribute of the Element object
 long getVersion()
          Gets the version attribute of the ElementAttributes object
 int hashCode()
          Description of the Method
 void resetAccessStatistics()
          Resets the hit count to 0 and the last access time to 0
 void setCreateTime()
          Sets the creationTime attribute of the ElementAttributes object
 void setVersion(long version)
          Sets the version attribute of the ElementAttributes object
 java.lang.String toString()
          Returns a String representation of the Element
 void updateAccessStatistics()
          Sets the previous to last access time to the last access time, and the last access time to now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Element

public Element(java.io.Serializable key,
               java.io.Serializable value,
               long version)
A full constructor.

Creation time is set to the current time. Last Access Time and Previous To Last Access Time are not set.


Element

public Element(java.io.Serializable key,
               java.io.Serializable value)
Constructor

Parameters:
key -
value -
Method Detail

getKey

public java.io.Serializable getKey()
Gets the key attribute of the Element object

Returns:
The key value

getValue

public java.io.Serializable getValue()
Gets the value attribute of the Element object

Returns:
The value value

hashCode

public int hashCode()
Description of the Method


setVersion

public void setVersion(long version)
Sets the version attribute of the ElementAttributes object

Parameters:
version - The new version value

getCreationTime

public long getCreationTime()
Gets the creationTime attribute of the ElementAttributes object

Returns:
The creationTime value

setCreateTime

public void setCreateTime()
Sets the creationTime attribute of the ElementAttributes object


getVersion

public long getVersion()
Gets the version attribute of the ElementAttributes object

Returns:
The version value

getLastAccessTime

public long getLastAccessTime()
Gets the last access time. Access means get or put. So a newly created Element will have a last access time equal to its create time.


getHitCount

public long getHitCount()
Gets the hit count on this element.


resetAccessStatistics

public void resetAccessStatistics()
Resets the hit count to 0 and the last access time to 0


updateAccessStatistics

public void updateAccessStatistics()
Sets the previous to last access time to the last access time, and the last access time to now.


toString

public java.lang.String toString()
Returns a String representation of the Element