net.sf.ehcache
Class AbstractElementData

java.lang.Object
  extended by org.terracotta.cache.value.AbstractStatelessTimestampedValue<Object>
      extended by net.sf.ehcache.AbstractElementData
All Implemented Interfaces:
TimestampedValue<Object>
Direct Known Subclasses:
IdentityModeElementData, SerializationModeElementData

public abstract class AbstractElementData
extends AbstractStatelessTimestampedValue<Object>

Author:
Alex Snaps

Field Summary
protected  boolean cacheDefaultLifespan
           
protected  long creationTime
           
protected  long hitCount
           
protected  long lastAccessTime
           
protected  long lastUpdateTime
           
protected  int timeToIdle
           
protected  int timeToLive
           
protected  Object value
           
protected  long version
           
 
Fields inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
UNUSED
 
Fields inherited from interface org.terracotta.cache.TimestampedValue
NEVER_EXPIRE
 
Constructor Summary
protected AbstractElementData(Object value, long version, long creationTime, long lastAccessTime, long hitCount, boolean cacheDefaultLifespan, int timeToLive, int timeToIdle, long lastUpdateTime)
           
 
Method Summary
 net.sf.ehcache.Element createElement(Object key)
           
 int expiresAt(CacheConfig config)
          Get the time at which this timestamp will become invalid.
protected abstract  CapacityEvictionPolicyData fastGetCapacityEvictionPolicyData()
           
abstract  CapacityEvictionPolicyData getCapacityEvictionPolicyData()
          Retrieves this value's capacity eviction policy data.
 int getCreateTime()
          Retrieves the time when this value was created.
 int getLastAccessedTime()
          Retrieves the time when this value was last accessed.
 Object getValue()
          Get the actual value in the cache.
abstract  void setCapacityEvictionPolicyData(CapacityEvictionPolicyData capacityEvictionPolicyData)
          Sets this value's capacity eviction policy data.
protected  void setLastAccessedTimeInternal(int usedAtTime)
           
 void write(ObjectOutputStream oos)
           
 
Methods inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
equals, hashCode, isExpired, markUsed, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected final Object value

version

protected final long version

creationTime

protected final long creationTime

lastAccessTime

protected long lastAccessTime

hitCount

protected final long hitCount

cacheDefaultLifespan

protected final boolean cacheDefaultLifespan

timeToLive

protected final int timeToLive

timeToIdle

protected final int timeToIdle

lastUpdateTime

protected final long lastUpdateTime
Constructor Detail

AbstractElementData

protected AbstractElementData(Object value,
                              long version,
                              long creationTime,
                              long lastAccessTime,
                              long hitCount,
                              boolean cacheDefaultLifespan,
                              int timeToLive,
                              int timeToIdle,
                              long lastUpdateTime)
Method Detail

setCapacityEvictionPolicyData

public abstract void setCapacityEvictionPolicyData(CapacityEvictionPolicyData capacityEvictionPolicyData)
Description copied from interface: TimestampedValue
Sets this value's capacity eviction policy data.

Parameters:
capacityEvictionPolicyData - the new data

getCapacityEvictionPolicyData

public abstract CapacityEvictionPolicyData getCapacityEvictionPolicyData()
Description copied from interface: TimestampedValue
Retrieves this value's capacity eviction policy data.

Returns:
this value's data

fastGetCapacityEvictionPolicyData

protected abstract CapacityEvictionPolicyData fastGetCapacityEvictionPolicyData()
Specified by:
fastGetCapacityEvictionPolicyData in class AbstractStatelessTimestampedValue<Object>

createElement

public net.sf.ehcache.Element createElement(Object key)

write

public void write(ObjectOutputStream oos)
           throws IOException
Throws:
IOException

getValue

public Object getValue()
Description copied from interface: TimestampedValue
Get the actual value in the cache.

Specified by:
getValue in interface TimestampedValue<Object>
Specified by:
getValue in class AbstractStatelessTimestampedValue<Object>
Returns:
The value

getLastAccessedTime

public int getLastAccessedTime()
Description copied from interface: TimestampedValue
Retrieves the time when this value was last accessed.

Specified by:
getLastAccessedTime in interface TimestampedValue<Object>
Specified by:
getLastAccessedTime in class AbstractStatelessTimestampedValue<Object>
Returns:
this value's last access time in seconds since epoch

setLastAccessedTimeInternal

protected void setLastAccessedTimeInternal(int usedAtTime)
Specified by:
setLastAccessedTimeInternal in class AbstractStatelessTimestampedValue<Object>

getCreateTime

public int getCreateTime()
Description copied from interface: TimestampedValue
Retrieves the time when this value was created.

Specified by:
getCreateTime in interface TimestampedValue<Object>
Specified by:
getCreateTime in class AbstractStatelessTimestampedValue<Object>
Returns:
this value's creation time in seconds since epoch

expiresAt

public int expiresAt(CacheConfig config)
Description copied from class: AbstractStatelessTimestampedValue
Get the time at which this timestamp will become invalid. If the config specified ttl == tti == 0, making items eternal, then this method returns TimestampedValue.NEVER_EXPIRE.

Specified by:
expiresAt in interface TimestampedValue<Object>
Overrides:
expiresAt in class AbstractStatelessTimestampedValue<Object>
Parameters:
config - The configuration
Returns:
Timestamp of expiration, >0, may be NEVER_EXPIRE if eternal


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.