Class CacheStatistics<K,​V>

  • All Implemented Interfaces:
    Cache4<K,​V>, java.lang.Iterable<V>

    public class CacheStatistics<K,​V>
    extends java.lang.Object
    implements Cache4<K,​V>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int calls()  
      java.util.Iterator<V> iterator()  
      int misses()  
      V produce​(K key, Function4<K,​V> producer, Procedure4<V> onDiscard)
      Retrieves the value associated to the key from the cache.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • CacheStatistics

        public CacheStatistics​(Cache4 delegate_)
    • Method Detail

      • produce

        public V produce​(K key,
                         Function4<K,​V> producer,
                         Procedure4<V> onDiscard)
        Description copied from interface: Cache4
        Retrieves the value associated to the key from the cache. If the value is not yet cached producer will be called to produce it. If the cache needs to discard a value finalizer will be given a chance to process it.
        Specified by:
        produce in interface Cache4<K,​V>
        Parameters:
        key - the key for the value - must never change - cannot be null
        producer - will be called if value not yet in the cache - can only be null when the value is found in the cache
        onDiscard - will be called if a page needs to be discarded - can be null
        Returns:
        the cached value
      • iterator

        public java.util.Iterator<V> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<K>
      • calls

        public int calls()
      • misses

        public int misses()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object