Package com.stardog.stark.util

# Class ValueWeigher<K>

java.lang.Object
com.stardog.stark.util.ValueWeigher<K>

All Implemented Interfaces:
  `com.github.benmanes.caffeine.cache.Weigher<K,Value>`

public final class ValueWeigher<K> extends Object implements com.github.benmanes.caffeine.cache.Weigher<K,Value>

Implementation of the Guava cache `Weigher` interface which will calculate the weight for a `Value` based on how much space is takes in memory.

Since:
  5.1.1
Version:
  5.1.1
Author:
  Evren Sirin

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ARRAY_OVERHEAD`
  `static final int`
  `BNODE_OVERHEAD`
  `static final int`
  `CAFFEINE_CACHE_ENTRY_OVERHEAD`
  `static final int`
  `CAL_LITERAL_OVERHEAD`
  `final int`
  `constantOverhead`
  `static final int`
  `ENUM_OVERHEAD`
  `static final int`
  `GUAVA_CACHE_ENTRY_OVERHEAD`
  `static final int`
  `IRI_OVERHEAD`
  `static final int`
  `LANG_LITERAL_OVERHEAD`
  `static final int`
  `LITERAL_OVERHEAD`
  `static final int`
  `OBJECT_OVERHEAD`
  `static final int`
  `REF_OVERHEAD`
  `static final int`
  `STRING_OVERHEAD`
  `static final int`
  `TYPED_LITERAL_OVERHEAD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ValueWeigher(int keyOverhead)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `weigh(K key, Value value)`
  `static int`
  `weightOf(Value value)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### OBJECT_OVERHEAD

    public static final int OBJECT_OVERHEAD
    See Also:
      - Constant Field Values

  - ### ENUM_OVERHEAD

    public static final int ENUM_OVERHEAD
    See Also:
      - Constant Field Values

  - ### REF_OVERHEAD

    public static final int REF_OVERHEAD
    See Also:
      - Constant Field Values

  - ### ARRAY_OVERHEAD

    public static final int ARRAY_OVERHEAD
    See Also:
      - Constant Field Values

  - ### STRING_OVERHEAD

    public static final int STRING_OVERHEAD
    See Also:
      - Constant Field Values

  - ### LITERAL_OVERHEAD

    public static final int LITERAL_OVERHEAD
    See Also:
      - Constant Field Values

  - ### TYPED_LITERAL_OVERHEAD

    public static final int TYPED_LITERAL_OVERHEAD
    See Also:
      - Constant Field Values

  - ### LANG_LITERAL_OVERHEAD

    public static final int LANG_LITERAL_OVERHEAD
    See Also:
      - Constant Field Values

  - ### CAL_LITERAL_OVERHEAD

    public static final int CAL_LITERAL_OVERHEAD
    See Also:
      - Constant Field Values

  - ### BNODE_OVERHEAD

    public static final int BNODE_OVERHEAD
    See Also:
      - Constant Field Values

  - ### IRI_OVERHEAD

    public static final int IRI_OVERHEAD
    See Also:
      - Constant Field Values

  - ### CAFFEINE_CACHE_ENTRY_OVERHEAD

    public static final int CAFFEINE_CACHE_ENTRY_OVERHEAD
    See Also:
      - Constant Field Values

  - ### GUAVA_CACHE_ENTRY_OVERHEAD

    public static final int GUAVA_CACHE_ENTRY_OVERHEAD
    See Also:
      - Constant Field Values

  - ### constantOverhead

    public final int constantOverhead

- ## Constructor Details

  - ### ValueWeigher

    public ValueWeigher(int keyOverhead)

- ## Method Details

  - ### weigh

    public int weigh(@Nonnull K key, @Nonnull Value value)
    Specified by:
      `weigh` in interface `com.github.benmanes.caffeine.cache.Weigher<K,Value>`

  - ### weightOf

    public static int weightOf(Value value)