Class CacheEntrySizeCalculator<K,​V>

    • Constructor Detail

      • CacheEntrySizeCalculator

        public CacheEntrySizeCalculator​(EntrySizeCalculator<? super K,​? super V> calculator)
    • Method Detail

      • calculateSize

        public long calculateSize​(K key,
                                  InternalCacheEntry<K,​V> ice)
        Description copied from interface: EntrySizeCalculator
        Method used to calculate how much memory in size the key and value use.
        Specified by:
        calculateSize in interface EntrySizeCalculator<K,​V>
        Parameters:
        key - The key for this entry to be used in size calculation
        ice - The value for this entry to be used in size calculation
        Returns:
        The size approximately in memory the key and value use
      • calculateSize

        public long calculateSize​(K key,
                                  V value,
                                  Metadata metadata,
                                  PrivateMetadata pvtMetadata)
        Description copied from interface: KeyValueMetadataSizeCalculator
        Method used to calculate how much memory in size the key, value and metadata use.
        Specified by:
        calculateSize in interface KeyValueMetadataSizeCalculator<K,​V>
        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
        pvtMetadata - The internal metadata for this entry to be used in size calculation
        Returns:
        The size approximately in memory the key, value and metadata use.