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, wait
calculateSize, equalsKey
public void start()
public long create(WrappedBytes key, int hashCode, InternalCacheEntry<WrappedBytes,WrappedBytes> ice)
OffHeapEntryFactory
create
in interface OffHeapEntryFactory
key
- the key to usehashCode
- the hashCode of the keyice
- the internal entry to usepublic long getSize(long entryAddress, boolean includeAllocationOverhead)
OffHeapEntryFactory
InternalCacheEntry
.getSize
in interface OffHeapEntryFactory
entryAddress
- the address of the entryincludeAllocationOverhead
- if true, align to 8 bytes and add 16 bytes allocation overheadpublic long getNext(long entryAddress)
OffHeapEntryFactory
getNext
in interface OffHeapEntryFactory
entryAddress
- the address of the entrypublic void setNext(long entryAddress, long value)
OffHeapEntryFactory
setNext
in interface OffHeapEntryFactory
entryAddress
- the address of the entry to updatevalue
- the value of the linked node to setpublic int getHashCode(long entryAddress)
OffHeapEntryFactory
getHashCode
in interface OffHeapEntryFactory
entryAddress
- the address of the entrypublic byte[] getKey(long address)
OffHeapEntryFactory
getKey
in interface OffHeapEntryFactory
address
- the address of the entrypublic InternalCacheEntry<WrappedBytes,WrappedBytes> fromMemory(long address)
fromMemory
in interface OffHeapEntryFactory
address
- the address to read the entry frompublic boolean equalsKey(long address, WrappedBytes wrappedBytes, int hashCode)
OffHeapEntryFactory
equalsKey
in interface OffHeapEntryFactory
address
- 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 OffHeapEntryFactory
address
- the address of the entry to checktrue
if the entry is expired, false
otherwisepublic long calculateSize(WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata)
OffHeapEntryFactory
calculateSize
in interface KeyValueMetadataSizeCalculator<WrappedBytes,WrappedBytes>
calculateSize
in interface OffHeapEntryFactory
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 calculationpublic long updateMaxIdle(long address, long currentTimeMillis)
OffHeapEntryFactory
updateMaxIdle
in interface OffHeapEntryFactory
address
- the address of the entry's to updatecurrentTimeMillis
- the timestamp to set for max idle access time (must be in milliseconds)Copyright © 2021 JBoss by Red Hat. All rights reserved.