public class OffHeapEntryFactoryImpl extends Object implements OffHeapEntryFactory
| Constructor and Description |
|---|
OffHeapEntryFactoryImpl() |
| Modifier and Type | Method and Description |
|---|---|
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
|
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)
Assumes the address doesn't contain the linked pointer at the beginning
|
int |
getHashCode(long entryAddress)
Returns the hashCode of the address.
|
byte[] |
getKey(long address)
Returns the key of the address.
|
long |
getNext(long entryAddress)
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 entryAddress,
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.
|
void |
setNext(long entryAddress,
long value)
Called to update the next pointer index when a collision occurs requiring a linked list within the entries
themselves
|
void |
start() |
long |
updateMaxIdle(long address,
long currentTimeMillis)
Update max idle time for an entry.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcalculateSize, equalsKeypublic void start()
public long create(WrappedBytes key, int hashCode, InternalCacheEntry<WrappedBytes,WrappedBytes> ice)
OffHeapEntryFactorycreate in interface OffHeapEntryFactorykey - the key to usehashCode - the hashCode of the keyice - the internal entry to usepublic long getSize(long entryAddress,
boolean includeAllocationOverhead)
OffHeapEntryFactoryInternalCacheEntry.getSize in interface OffHeapEntryFactoryentryAddress - the address of the entryincludeAllocationOverhead - if true, align to 8 bytes and add 16 bytes allocation overheadpublic long getNext(long entryAddress)
OffHeapEntryFactorygetNext in interface OffHeapEntryFactoryentryAddress - the address of the entrypublic void setNext(long entryAddress,
long value)
OffHeapEntryFactorysetNext in interface OffHeapEntryFactoryentryAddress - the address of the entry to updatevalue - the value of the linked node to setpublic int getHashCode(long entryAddress)
OffHeapEntryFactorygetHashCode in interface OffHeapEntryFactoryentryAddress - the address of the entrypublic byte[] getKey(long address)
OffHeapEntryFactorygetKey in interface OffHeapEntryFactoryaddress - the address of the entrypublic InternalCacheEntry<WrappedBytes,WrappedBytes> fromMemory(long address)
fromMemory in interface OffHeapEntryFactoryaddress - the address to read the entry frompublic boolean equalsKey(long address,
WrappedBytes wrappedBytes,
int hashCode)
OffHeapEntryFactoryequalsKey in interface OffHeapEntryFactoryaddress - the address of the entry's key to checkwrappedBytes - the key to check equality withhashCode - the hashCode of the keypublic boolean isExpired(long address)
isExpired in interface OffHeapEntryFactoryaddress - the address of the entry to checktrue if the entry is expired, false otherwisepublic long calculateSize(WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata)
OffHeapEntryFactorycalculateSize in interface KeyValueMetadataSizeCalculator<WrappedBytes,WrappedBytes>calculateSize in interface OffHeapEntryFactorykey - 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 calculationpublic long updateMaxIdle(long address,
long currentTimeMillis)
OffHeapEntryFactoryupdateMaxIdle in interface OffHeapEntryFactoryaddress - the address of the entry's to updatecurrentTimeMillis - the timestamp to set for max idle access time (must be in milliseconds)Copyright © 2022 JBoss by Red Hat. All rights reserved.