org.terracotta.cache.serialization
Class SerializedEntry<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>
All Implemented Interfaces:
TimestampedValue<byte[]>
Direct Known Subclasses:
CustomLifespanSerializedEntry

public class SerializedEntry<T>
extends AbstractTimestampedValue<byte[]>

Wrapper class around the serialized cache entries. This handles the serialization and de-serialization of the cache entries, and also the local caching (in a transient reference) of the de-serialized value.


Field Summary
 
Fields inherited from class org.terracotta.cache.value.AbstractStatelessTimestampedValue
UNUSED
 
Fields inherited from interface org.terracotta.cache.TimestampedValue
NEVER_EXPIRE
 
Constructor Summary
SerializedEntry(T deserialized, byte[] serialized, int createTime)
           
SerializedEntry(T deserialized, byte[] serialized, int createTime, int lastAccessedTime)
           
SerializedEntry(T deserialized, byte[] serialized, TimeSource timeSource)
           
 
Method Summary
 int getCreateTime()
          Retrieves the time when this value was created.
 T getDeserializedValue(SerializationStrategy<T> strategy)
           
 T getDeserializedValue(SerializationStrategy<T> strategy, ClassLoader classLoader)
           
 T getDeserializedValueCopy(SerializationStrategy<T> strategy)
           
 T getDeserializedValueCopy(SerializationStrategy<T> strategy, ClassLoader classLoader)
           
 byte[] getValue()
          Get the actual value in the cache.
 void 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, expiresAt, hashCode, isExpired, markUsed, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerializedEntry

public SerializedEntry(T deserialized,
                       byte[] serialized,
                       TimeSource timeSource)

SerializedEntry

public SerializedEntry(T deserialized,
                       byte[] serialized,
                       int createTime)

SerializedEntry

public SerializedEntry(T deserialized,
                       byte[] serialized,
                       int createTime,
                       int lastAccessedTime)
Method Detail

getDeserializedValueCopy

public T getDeserializedValueCopy(SerializationStrategy<T> strategy)
                           throws IOException,
                                  ClassNotFoundException
Throws:
IOException
ClassNotFoundException

getDeserializedValueCopy

public T getDeserializedValueCopy(SerializationStrategy<T> strategy,
                                  ClassLoader classLoader)
                           throws IOException,
                                  ClassNotFoundException
Throws:
IOException
ClassNotFoundException

getDeserializedValue

public T getDeserializedValue(SerializationStrategy<T> strategy)
                       throws IOException,
                              ClassNotFoundException
Throws:
IOException
ClassNotFoundException

getDeserializedValue

public T getDeserializedValue(SerializationStrategy<T> strategy,
                              ClassLoader classLoader)
                       throws IOException,
                              ClassNotFoundException
Throws:
IOException
ClassNotFoundException

nullByteArray

public void nullByteArray()

getCreateTime

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

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

getValue

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

Specified by:
getValue in interface TimestampedValue<byte[]>
Specified by:
getValue in class AbstractStatelessTimestampedValue<byte[]>
Returns:
The value


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