Class CacheAccessTracker<K,​V>

  • All Implemented Interfaces:
    Cache<K,​V>

    public class CacheAccessTracker<K,​V>
    extends Object
    implements Cache<K,​V>
    Cache wrapper exposing the number of read accesses and the number of misses ot the underlying cache via the StatisticsProvider.
    • Constructor Detail

      • CacheAccessTracker

        public CacheAccessTracker​(@NotNull
                                  @NotNull String name,
                                  @NotNull
                                  @NotNull org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider,
                                  @NotNull
                                  @NotNull Cache<K,​V> delegate)
        Create a new wrapper exposing the access statistics under the given name to the passed statisticsProvider.
        Parameters:
        name - name under which to expose the access statistics
        statisticsProvider - statistics provider where the access statistics is recorded to
        delegate - the underlying, wrapped cache.
    • Method Detail

      • put

        public void put​(@NotNull
                        K key,
                        @NotNull
                        V value)
        Description copied from interface: Cache
        Add a mapping from key to value.
        Specified by:
        put in interface Cache<K,​V>
      • put

        public void put​(@NotNull
                        K key,
                        @NotNull
                        V value,
                        byte cost)
        Description copied from interface: Cache
        Add a mapping from key to value with a given cost.
        Specified by:
        put in interface Cache<K,​V>
      • get

        @Nullable
        public V get​(@NotNull
                     K key)
        Specified by:
        get in interface Cache<K,​V>
        Returns:
        The mapping for key, or null if none.