org.terracotta.cache.serialization
Class CustomLifespanSerializedEntry<T>
java.lang.Object
org.terracotta.cache.value.AbstractStatelessTimestampedValue<V>
org.terracotta.cache.value.AbstractTimestampedValue<byte[]>
org.terracotta.cache.serialization.SerializedEntry<T>
org.terracotta.cache.serialization.CustomLifespanSerializedEntry<T>
- All Implemented Interfaces:
- Externalizable, Serializable, ExpirableEntry, MarkTimestampedValue, TimestampedValue<byte[]>
public class CustomLifespanSerializedEntry<T>
- extends SerializedEntry<T>
A SerializedEntry subclass that supports cache entries with custom TTI/TTL values.
- Author:
- Chris Dennis
- See Also:
- Serialized Form
|
Constructor Summary |
CustomLifespanSerializedEntry()
|
CustomLifespanSerializedEntry(SerializedEntryParameters<T> params,
int tti,
int ttl)
|
CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
int createTime)
Constructs a serialized entry with a custom lifespan and creation time. |
CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
int createTime,
int lastAccessedTime)
Constructs a serialized entry with a custom lifespan, creation time, and last accessed time. |
CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
TimeSource timeSource)
Constructs a serialized entry with a custom lifespan and creation time. |
| Methods inherited from class org.terracotta.cache.serialization.SerializedEntry |
addedToLocalCache, equals, getCreateTime, getDeserializedValue, getDeserializedValue, getDeserializedValueCopy, getDeserializedValueCopy, getValue, markTxnComplete, markTxnInProgress, nullByteArray, shouldRecalculateSize, toString, unsafelyGetDeserializedValue, unsafelyGetDeserializedValueCopy |
CustomLifespanSerializedEntry
public CustomLifespanSerializedEntry()
CustomLifespanSerializedEntry
public CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
TimeSource timeSource)
- Constructs a serialized entry with a custom lifespan and creation time.
The constructed entry will have it's creation and last accessed time set to be the same, as would be normal for a
newly constructed entry.
- Parameters:
deserialized - non-serialized entry valueserialized - serialized entry valuetti - custom time-to-idlettl - custom time-to-livetimeSource - source for timestamps
CustomLifespanSerializedEntry
public CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
int createTime)
- Constructs a serialized entry with a custom lifespan and creation time.
The constructed entry will have it's creation and last accessed time set to be the same, as would be normal for a
newly constructed entry.
- Parameters:
deserialized - non-serialized entry valueserialized - serialized entry valuetti - custom time-to-idlettl - custom time-to-livecreateTime - creation/last accessed time
CustomLifespanSerializedEntry
public CustomLifespanSerializedEntry(T deserialized,
byte[] serialized,
int tti,
int ttl,
int createTime,
int lastAccessedTime)
- Constructs a serialized entry with a custom lifespan, creation time, and last accessed time.
- Parameters:
deserialized - non-serialized entry valueserialized - serialized entry valuetti - custom time-to-idlettl - custom time-to-livecreateTime - creation timelastAccessedTime - last accessed time
CustomLifespanSerializedEntry
public CustomLifespanSerializedEntry(SerializedEntryParameters<T> params,
int tti,
int ttl)
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
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
- Specified by:
writeExternal in interface Externalizable- Overrides:
writeExternal in class SerializedEntry<T>
- Throws:
IOException
readExternal
public void readExternal(ObjectInput in)
throws IOException
- Specified by:
readExternal in interface Externalizable- Overrides:
readExternal in class SerializedEntry<T>
- Throws:
IOException
Copyright © 2015 Terracotta, Inc.. All Rights Reserved.