org.terracotta.cache.serialization
Class CustomLifespanSerializedEntry<T>

java.lang.Object
  extended by org.terracotta.cache.value.AbstractStatelessTimestampedValue<V>
      extended by org.terracotta.cache.value.AbstractTimestampedValue<byte[]>
          extended by org.terracotta.cache.serialization.SerializedEntry<T>
              extended by org.terracotta.cache.serialization.CustomLifespanSerializedEntry<T>
All Implemented Interfaces:
TimestampedValue<byte[]>

public class CustomLifespanSerializedEntry<T>
extends SerializedEntry<T>

A SerializedEntry subclass that supports cache entries with custom TTI/TTL values.

Author:
Chris Dennis

Field Summary
 
Fields inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
UNUSED
 
Fields inherited from interface org.terracotta.cache.TimestampedValue
NEVER_EXPIRE
 
Constructor Summary
CustomLifespanSerializedEntry(T deserialized, byte[] serialized, int tti, int ttl, int createTime)
           
CustomLifespanSerializedEntry(T deserialized, byte[] serialized, int tti, int ttl, int createTime, int lastAccessedTime)
           
CustomLifespanSerializedEntry(T deserialized, byte[] serialized, int tti, int ttl, TimeSource timeSource)
           
 
Method Summary
 int expiresAt(CacheConfig config)
          Get the time at which this timestamp will become invalid.
 
Methods inherited from class org.terracotta.cache.serialization.SerializedEntry
getCreateTime, getDeserializedValue, getDeserializedValue, getDeserializedValueCopy, getDeserializedValueCopy, getValue, nullByteArray
 
Methods inherited from class org.terracotta.cache.value.AbstractTimestampedValue
fastGetCapacityEvictionPolicyData, getCapacityEvictionPolicyData, getLastAccessedTime, setCapacityEvictionPolicyData, setLastAccessedTimeInternal
 
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
 

Constructor Detail

CustomLifespanSerializedEntry

public CustomLifespanSerializedEntry(T deserialized,
                                     byte[] serialized,
                                     int tti,
                                     int ttl,
                                     TimeSource timeSource)

CustomLifespanSerializedEntry

public CustomLifespanSerializedEntry(T deserialized,
                                     byte[] serialized,
                                     int tti,
                                     int ttl,
                                     int createTime)

CustomLifespanSerializedEntry

public CustomLifespanSerializedEntry(T deserialized,
                                     byte[] serialized,
                                     int tti,
                                     int ttl,
                                     int createTime,
                                     int lastAccessedTime)
Method Detail

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<byte[]>
Overrides:
expiresAt in class AbstractStatelessTimestampedValue<byte[]>
Parameters:
config - The configuration
Returns:
Timestamp of expiration, >0, may be NEVER_EXPIRE if eternal


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