Interface KeyValueMetadataSizeCalculator<K,V>

All Known Subinterfaces:
OffHeapEntryFactory
All Known Implementing Classes:
CacheEntrySizeCalculator, OffHeapEntryFactoryImpl
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface KeyValueMetadataSizeCalculator<K,V>
Size calculator that takes into account not only key and value but also metadata.
Since:
9.0
Author:
wburns
  • Method Summary

    Modifier and Type
    Method
    Description
    default long
    calculateSize(K key, V value, Metadata metadata)
    Method used to calculate how much memory in size the key, value and metadata use.
    long
    calculateSize(K key, V value, Metadata metadata, PrivateMetadata internalMetadata)
    Method used to calculate how much memory in size the key, value and metadata use.
  • Method Details

    • calculateSize

      default long calculateSize(K key, V value, Metadata metadata)
      Method used to calculate how much memory in size the key, value and metadata use.
      Parameters:
      key - The key for this entry to be used in size calculation
      value - The value for this entry to be used in size calculation
      metadata - The metadata for this entry to be used in size calculation
      Returns:
      The size approximately in memory the key, value and metadata use.
    • calculateSize

      long calculateSize(K key, V value, Metadata metadata, PrivateMetadata internalMetadata)
      Method used to calculate how much memory in size the key, value and metadata use.
      Parameters:
      key - The key for this entry to be used in size calculation
      value - The value for this entry to be used in size calculation
      metadata - The metadata for this entry to be used in size calculation
      internalMetadata - The internal metadata for this entry to be used in size calculation
      Returns:
      The size approximately in memory the key, value and metadata use.