ehcache

net.sf.ehcache
Class DefaultElementEvictionData

java.lang.Object
  extended by net.sf.ehcache.DefaultElementEvictionData
All Implemented Interfaces:
Cloneable, ElementEvictionData

public class DefaultElementEvictionData
extends Object
implements ElementEvictionData

Default implementation of the element eviction data storage that just keeps all the data in instance fields in the heap.

Version:
$Id: DefaultElementEvictionData.java 1219 2009-09-25 05:10:31Z gbevin $
Author:
Geert Bevin

Constructor Summary
DefaultElementEvictionData(long creationTime)
          Default constructor initializing the field to their empty values
DefaultElementEvictionData(long creationTime, long lastAccessTime)
          Constructor allowing custom values for the data fields.
 
Method Summary
 boolean canParticipateInSerialization()
          Indicates whether the data of this element eviction instance can participate in serialization of the element as a whole.
 ElementEvictionData clone()
          Creates a clone of the eviction data
 long getCreationTime()
          Get the element's creation time.
 long getLastAccessTime()
          Gets the last access time.
 void resetLastAccessTime(Element element)
          Resets the last access time.
 void setCreationTime(long creationTime)
          Sets the element creation time.
 void updateLastAccessTime(long time, Element element)
          Updates the last access time.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultElementEvictionData

public DefaultElementEvictionData(long creationTime)
Default constructor initializing the field to their empty values


DefaultElementEvictionData

public DefaultElementEvictionData(long creationTime,
                                  long lastAccessTime)
Constructor allowing custom values for the data fields.

Parameters:
lastAccessTime -
Method Detail

setCreationTime

public void setCreationTime(long creationTime)
Sets the element creation time. Note that this is optional to implement and might result in a no-op.

Specified by:
setCreationTime in interface ElementEvictionData
Parameters:
creationTime - the new element's creation time

getCreationTime

public long getCreationTime()
Get the element's creation time.

Specified by:
getCreationTime in interface ElementEvictionData
Returns:
the element's creation time in seconds

getLastAccessTime

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

Specified by:
getLastAccessTime in interface ElementEvictionData
Returns:
the element's last access time in seconds

updateLastAccessTime

public void updateLastAccessTime(long time,
                                 Element element)
Updates the last access time.

Specified by:
updateLastAccessTime in interface ElementEvictionData
Parameters:
time - the new last access time
element - the element for which the last access time is set

resetLastAccessTime

public void resetLastAccessTime(Element element)
Resets the last access time.

Specified by:
resetLastAccessTime in interface ElementEvictionData
Parameters:
element - the element for which the last access time is set

clone

public final ElementEvictionData clone()
                                throws CloneNotSupportedException
Creates a clone of the eviction data

Specified by:
clone in interface ElementEvictionData
Overrides:
clone in class Object
Returns:
a clone of the eviction data
Throws:
CloneNotSupportedException

canParticipateInSerialization

public boolean canParticipateInSerialization()
Indicates whether the data of this element eviction instance can participate in serialization of the element as a whole.

Specified by:
canParticipateInSerialization in interface ElementEvictionData
Returns:
true when the data can participate in serialization; or false otherwise

ehcache

Copyright © 2003-2012 Terracotta, Inc.. All Rights Reserved.