Interface Cache.Shrinkable<V>

  • All Known Implementing Classes:
    PrecombineGroupingTable
    Enclosing interface:
    Cache<K,​V>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @ThreadSafe
    @FunctionalInterface
    public static interface Cache.Shrinkable<V>
    An interface that marks an object that can be reduced in size instead of being evicted completely.

    Types should consider implementing Weighted to not invoke the overhead of using the default weigher multiple times.

    This interface may be invoked from any other thread that manipulates the cache causing this value to be shrunk. Implementers must ensure thread safety with respect to any side effects caused.

    • Method Detail

      • shrink

        @Nullable
        V shrink()
        Returns a new object that is smaller than the object being evicted.

        It is recommended to return an object that is at most half as large as the one being evicted. If null is returned then the object will be evicted.