|
ehcache | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ehcache.Element
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:getObjectKey()
and
getObjectValue()
. If placing Objects in ehcace, developers must use the new getObject... methods to
avoid CacheExceptions. The get... methods are reserved for Serializable keys and values.
Constructor Summary | |
Element(java.lang.Object key,
java.lang.Object value)
Constructor. |
|
Element(java.lang.Object key,
java.lang.Object value,
long version)
A full constructor. |
|
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 | |
java.lang.Object |
clone()
Clones an Element. |
boolean |
equals(java.lang.Object object)
Equals comparison with another element, based on the key. |
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.lang.Object |
getObjectKey()
Gets the key attribute of the Element object. |
java.lang.Object |
getObjectValue()
Gets the value attribute of the Element object as an Object. |
long |
getSerializedSize()
The size of this object in serialized form. |
java.io.Serializable |
getValue()
Gets the value attribute of the Element object. |
long |
getVersion()
Gets the version attribute of the ElementAttributes object. |
int |
hashCode()
Gets the hascode, based on the key. |
boolean |
isKeySerializable()
Whether the element's key may be Serialized. |
boolean |
isSerializable()
Whether the element may be Serialized. |
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 last access time to now. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Element(java.io.Serializable key, java.io.Serializable value, long version)
public Element(java.lang.Object key, java.lang.Object value, long version)
public Element(java.io.Serializable key, java.io.Serializable value)
key
- value
- public Element(java.lang.Object key, java.lang.Object value)
key
- value
- Method Detail |
public final java.io.Serializable getKey()
getObjectKey()
public final java.lang.Object getObjectKey()
getKey()
public final java.io.Serializable getValue()
getObjectValue()
. If the value is not Serializable, null is returned and an info log message emittedgetObjectValue()
public final java.lang.Object getObjectValue()
getValue()
public final boolean equals(java.lang.Object object)
public final int hashCode()
public final void setVersion(long version)
version
- The new version valuepublic final long getCreationTime()
public final void setCreateTime()
public final long getVersion()
public final long getLastAccessTime()
Element
will have a last access time equal to its create time.
public final long getHitCount()
public final void resetAccessStatistics()
public final void updateAccessStatistics()
public final java.lang.String toString()
String
representation of the Element
.
public final java.lang.Object clone() throws java.lang.CloneNotSupportedException
Element
, with exactly the same field values as the one it was cloned from.
java.lang.CloneNotSupportedException
public final long getSerializedSize()
public final boolean isSerializable()
public final boolean isKeySerializable()
|
ehcache | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |