Class EmpiricalWeigher

  • All Implemented Interfaces:
    Weigher<CacheValue,​CacheValue>

    public class EmpiricalWeigher
    extends java.lang.Object
    implements Weigher<CacheValue,​CacheValue>
    Determines the weight of object based on the memory taken by them. The memory estimates are based on empirical data and not exact
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int weigh​(CacheValue key, CacheValue value)
      Returns the weight of a cache entry.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EmpiricalWeigher

        public EmpiricalWeigher()
    • Method Detail

      • weigh

        public int weigh​(CacheValue key,
                         CacheValue value)
        Description copied from interface: Weigher
        Returns the weight of a cache entry. There is no unit for entry weights; rather they are simply relative to each other.
        Specified by:
        weigh in interface Weigher<CacheValue,​CacheValue>
        Returns:
        the weight of the entry; must be non-negative