org.terracotta.cache.value
Class AbstractTimestampedValue<V>

java.lang.Object
  extended by org.terracotta.cache.value.AbstractStatelessTimestampedValue<V>
      extended by org.terracotta.cache.value.AbstractTimestampedValue<V>
All Implemented Interfaces:
ExpirableEntry, MarkTimestampedValue, TimestampedValue<V>
Direct Known Subclasses:
DefaultTimestampedValue, SerializedEntry

public abstract class AbstractTimestampedValue<V>
extends AbstractStatelessTimestampedValue<V>

Abstract base class for timestamped map entries. This class defines the timestamp manipulation logic and locking that should be common for all entries


Field Summary
protected  int lastAccessedTime
          Last time when this item was used guarded by synchronized(this) with terracotta auto-locks time is seconds since the epoch (System.currentTimeMillis() / 1000) for example)
 
Fields inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
UNUSED
 
Fields inherited from interface org.terracotta.cache.TimestampedValue
NEVER_EXPIRE
 
Constructor Summary
protected AbstractTimestampedValue()
           
 
Method Summary
protected  CapacityEvictionPolicyData fastGetCapacityEvictionPolicyData()
           
 CapacityEvictionPolicyData getCapacityEvictionPolicyData()
          Retrieves this value's capacity eviction policy data.
 int getLastAccessedTime()
          Retrieves the time when this value was last accessed.
 void setCapacityEvictionPolicyData(CapacityEvictionPolicyData capacityEvictionPolicy)
          Sets this value's capacity eviction policy data.
protected  void setLastAccessedTimeInternal(int usedAtTime)
           
 
Methods inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
equals, expiresAt, expiresAt, getCreateTime, getValue, hashCode, isExpired, markUsed, markUsed, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

lastAccessedTime

protected volatile int lastAccessedTime
Last time when this item was used guarded by synchronized(this) with terracotta auto-locks time is seconds since the epoch (System.currentTimeMillis() / 1000) for example)

Constructor Detail

AbstractTimestampedValue

protected AbstractTimestampedValue()
Method Detail

setCapacityEvictionPolicyData

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

Parameters:
capacityEvictionPolicy - the new data

getCapacityEvictionPolicyData

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

Returns:
this value's data

fastGetCapacityEvictionPolicyData

protected final CapacityEvictionPolicyData fastGetCapacityEvictionPolicyData()
Specified by:
fastGetCapacityEvictionPolicyData in class AbstractStatelessTimestampedValue<V>

getLastAccessedTime

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

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

setLastAccessedTimeInternal

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


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