Interface EntryWeigher<K,V>

Type Parameters:
K - 键类型
V - 值类型

public interface EntryWeigher<K,V>
A class that can determine the selector of an entry. The total selector threshold is used to determine when an eviction is required.
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    weightOf(K key, V value)
    Measures an entry's selector to determine how many units of capacity that the data and value consumes.
  • Method Details

    • weightOf

      int weightOf(K key, V value)
      Measures an entry's selector to determine how many units of capacity that the data and value consumes. An entry must consume a minimum of one unit.
      Parameters:
      key - the data to weigh
      value - the value to weigh
      Returns:
      the entry's selector