Interface MarshallableEntryFactory<K,V>
public interface MarshallableEntryFactory<K,V>
Factory for
MarshallableEntry.- Since:
- 10.0
- Author:
- Ryan Emerson
-
Method Summary
Modifier and TypeMethodDescriptioncloneWithExpiration(MarshallableEntry<K, V> me, long creationTime, long lifespan) Clone the provided MarshallableEntry if needed to apply lifespan expiration.valuedefaults to nullmetadatadefaults to nullcreateddefaults to -1lastUseddefaults to -1create(Object key, Object value, Metadata metadata, PrivateMetadata internalMetadata, long created, long lastUsed) Creates aMarshallableEntryusing non-marshalled POJOs as argumentscreate(Object key, ByteBuffer valueBytes, ByteBuffer metadataBytes, ByteBuffer internalMetadataBytes, long created, long lastUsed) Creates aMarshallableEntryusing a object key and already marshalled value/metadata as argumentsdefault MarshallableEntry<K, V> create(Object key, InternalCacheValue<V> v) create(Object key, MarshalledValue value) Creates aMarshallableEntryusing a KeyMarshalledValue.create(ByteBuffer key, ByteBuffer valueBytes) metadataBytesdefaults to nullcreateddefaults to -1lastUseddefaults to -1create(ByteBuffer key, ByteBuffer valueBytes, ByteBuffer metadataBytes, ByteBuffer internalMetadataBytes, long created, long lastUsed) Creates aMarshallableEntryusing already marshalled objects as argumentsdefault MarshallableEntry<K, V> create(InternalCacheEntry<K, V> e) Creates aMarshallableEntryinstance from anInternalCacheEntry.getEmpty()
-
Method Details
-
create
metadataBytesdefaults to nullcreateddefaults to -1lastUseddefaults to -1- See Also:
-
create
MarshallableEntry<K,V> create(ByteBuffer key, ByteBuffer valueBytes, ByteBuffer metadataBytes, ByteBuffer internalMetadataBytes, long created, long lastUsed) Creates aMarshallableEntryusing already marshalled objects as arguments- Parameters:
key-ByteBufferof serialized key objectvalueBytes-ByteBufferof serialized value objectmetadataBytes-ByteBufferof serialized metadata objectinternalMetadataBytes-ByteBufferof serialized internal metadata objectcreated- timestamp of when the entry was created, -1 means this value is ignoredlastUsed- timestamp of last time entry was accessed in memory- Returns:
MarshallableEntryinstance that lazily handles unmarshalling of keys, values and metadata via theMarshallableEntry.getKey(),MarshallableEntry.getValue()andMarshallableEntry.getMetadata()methods.
-
create
MarshallableEntry<K,V> create(Object key, ByteBuffer valueBytes, ByteBuffer metadataBytes, ByteBuffer internalMetadataBytes, long created, long lastUsed) Creates aMarshallableEntryusing a object key and already marshalled value/metadata as arguments- Parameters:
key- entry keyvalueBytes-ByteBufferof serialized value objectmetadataBytes-ByteBufferof serialized metadata objectinternalMetadataBytes-ByteBufferof serialized internal metadata objectcreated- timestamp of when the entry was created, -1 means this value is ignoredlastUsed- timestamp of last time entry was accessed in memory- Returns:
MarshallableEntryinstance that lazily handles unmarshalling of values and metadata via theMarshallableEntry.getKey(),MarshallableEntry.getValue()andMarshallableEntry.getMetadata()methods.
-
create
-
create
metadatadefaults to nullcreateddefaults to -1lastUseddefaults to -1- See Also:
-
create
MarshallableEntry<K,V> create(Object key, Object value, Metadata metadata, PrivateMetadata internalMetadata, long created, long lastUsed) Creates aMarshallableEntryusing non-marshalled POJOs as arguments- Parameters:
key- entry keyvalue- entry valuemetadata- entry metadatainternalMetadata- entry internal metadatacreated- timestamp of when the entry was created, -1 means this value is ignoredlastUsed- timestamp of last time entry was accessed in memory- Returns:
MarshallableEntryinstance that lazily handles serialization of keys, values and metadata via theMarshallableEntry.getKeyBytes(),MarshallableEntry.getValueBytes()andMarshallableEntry.getMetadataBytes()methods.
-
create
- Parameters:
key- the entry key.v- theInternalCacheValue.
-
create
Creates aMarshallableEntryinstance from anInternalCacheEntry.- Parameters:
e- theInternalCacheEntry.
-
create
Creates aMarshallableEntryusing a KeyMarshalledValue.- Parameters:
key- entry keyvalue- aMarshalledValuewhose values are used to populateMarshallableEntry.getValueBytes(),MarshallableEntry.getMetadataBytes(),MarshallableEntry.created()andMarshallableEntry.lastUsed()fields.- Returns:
MarshallableEntryinstance that lazily handles unmarshalling of keys, values and metadata via theMarshallableEntry.getKey(),MarshallableEntry.getValue()andMarshallableEntry.getMetadata()methods.- Throws:
NullPointerException- if the providedMarshalledValueis null.
-
cloneWithExpiration
MarshallableEntry<K,V> cloneWithExpiration(MarshallableEntry<K, V> me, long creationTime, long lifespan) Clone the provided MarshallableEntry if needed to apply lifespan expiration. If the entry already has lifespan applied this method will do nothing, returning the same MarshallableEntry back.- Parameters:
me- the entry to clone if applicablecreationTime- the creation time to apply for lifespanlifespan- the duration for which the entry will expire after the creationTime- Returns:
- a new entry if lifespan was applied otherwise the same entry provided
-
getEmpty
MarshallableEntry<K,V> getEmpty()- Returns:
- a cached empty
MarshallableEntryinstance.
-