public interface OffHeapEntryFactory extends KeyValueMetadataSizeCalculator<WrappedBytes,WrappedBytes>
InternalCacheEntry
objects that use off-heap heap memory. These are stored by
a long to symbolize the memory address.Modifier and Type | Method and Description |
---|---|
default long |
calculateSize(WrappedBytes key,
WrappedBytes value,
Metadata metadata)
Method used to calculate how much memory in size the key, value and metadata use.
|
long |
calculateSize(WrappedBytes key,
WrappedBytes value,
Metadata metadata,
PrivateMetadata internalMetadata)
Method used to calculate how much memory in size the key, value, metadata and internal metadata use.
|
long |
create(WrappedBytes key,
int hashCode,
InternalCacheEntry<WrappedBytes,WrappedBytes> ice)
Creates an off heap entry using the provided key value and metadata
|
default boolean |
equalsKey(long address,
WrappedBytes wrappedBytes)
Returns whether the given key as bytes is the same key as the key stored in the entry for the given address.
|
boolean |
equalsKey(long address,
WrappedBytes wrappedBytes,
int hashCode)
Returns whether the given key as bytes is the same key as the key stored in the entry for the given address.
|
InternalCacheEntry<WrappedBytes,WrappedBytes> |
fromMemory(long address)
Create an entry from the off heap pointer
|
int |
getHashCode(long address)
Returns the hashCode of the address.
|
byte[] |
getKey(long address)
Returns the key of the address.
|
long |
getNext(long address)
Returns the address to the next linked pointer if there is one for this bucket or 0 if there isn't one
|
long |
getSize(long address,
boolean includeAllocationOverhead)
Returns how many bytes in memory this address location uses assuming it is an
InternalCacheEntry . |
boolean |
isExpired(long address)
Returns whether entry is expired or not.
|
void |
setNext(long address,
long value)
Called to update the next pointer index when a collision occurs requiring a linked list within the entries
themselves
|
long |
updateMaxIdle(long address,
long accessTime)
Update max idle time for an entry.
|
long create(WrappedBytes key, int hashCode, InternalCacheEntry<WrappedBytes,WrappedBytes> ice)
key
- the key to usehashCode
- the hashCode of the keyice
- the internal entry to uselong getSize(long address, boolean includeAllocationOverhead)
InternalCacheEntry
.address
- the address of the entryincludeAllocationOverhead
- if true, align to 8 bytes and add 16 bytes allocation overheadlong getNext(long address)
address
- the address of the entryvoid setNext(long address, long value)
address
- the address of the entry to updatevalue
- the value of the linked node to setint getHashCode(long address)
address
- the address of the entrybyte[] getKey(long address)
address
- the address of the entryInternalCacheEntry<WrappedBytes,WrappedBytes> fromMemory(long address)
address
- the address of the entry to readdefault boolean equalsKey(long address, WrappedBytes wrappedBytes)
address
- the address of the entry's key to checkwrappedBytes
- the key to check equality withboolean equalsKey(long address, WrappedBytes wrappedBytes, int hashCode)
address
- the address of the entry's key to checkwrappedBytes
- the key to check equality withhashCode
- the hashCode of the keyboolean isExpired(long address)
address
- the address of the entry's key to checktrue
if the entry is expired, false
otherwisedefault long calculateSize(WrappedBytes key, WrappedBytes value, Metadata metadata)
calculateSize
in interface KeyValueMetadataSizeCalculator<WrappedBytes,WrappedBytes>
key
- The key for this entry to be used in size calculationvalue
- The value for this entry to be used in size calculationmetadata
- The metadata for this entry to be used in size calculationlong calculateSize(WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata)
calculateSize
in interface KeyValueMetadataSizeCalculator<WrappedBytes,WrappedBytes>
key
- The key for this entry to be used in size calculationvalue
- The value for this entry to be used in size calculationmetadata
- The metadata for this entry to be used in size calculationinternalMetadata
- The internal metadata for this entry to be used in size calculationlong updateMaxIdle(long address, long accessTime)
address
- the address of the entry's to updateaccessTime
- the timestamp to set for max idle access time (must be in milliseconds)Copyright © 2021 JBoss by Red Hat. All rights reserved.