Interface LocalCache<K,​V>

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void cleanUp()
      default V compute​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)  
      V compute​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction, boolean recordMiss, boolean recordLoad)
      See ConcurrentMap.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>).
      default V computeIfAbsent​(K key, java.util.function.Function<? super K,​? extends V> mappingFunction)  
      V computeIfAbsent​(K key, java.util.function.Function<? super K,​? extends V> mappingFunction, boolean recordStats, boolean recordLoad)
      See ConcurrentMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>).
      long estimatedSize()
      java.util.concurrent.Executor executor()
      Returns the Executor used by this cache.
      Ticker expirationTicker()
      Returns the Ticker used by this cache for expiration.
      java.util.Map<K,​V> getAllPresent​(java.lang.Iterable<?> keys)
      V getIfPresent​(java.lang.Object key, boolean recordStats)
      V getIfPresentQuietly​(java.lang.Object key, long[] writeTime)
      boolean hasRemovalListener()
      Returns whether this cache notifies when an entry is removed.
      boolean hasWriteTime()
      Returns whether the cache captures the write time of the entry.
      default void invalidateAll​(java.lang.Iterable<?> keys)
      boolean isRecordingStats()
      Returns whether this cache has statistics enabled.
      void notifyRemoval​(K key, V value, RemovalCause cause)
      Asynchronously sends a removal notification to the listener.
      V put​(K key, V value, boolean notifyWriter)
      RemovalListener<K,​V> removalListener()
      Returns the RemovalListener used by this cache or null if not used.
      default <T,​U,​R>
      java.util.function.BiFunction<? super T,​? super U,​? extends R>
      statsAware​(java.util.function.BiFunction<? super T,​? super U,​? extends R> remappingFunction)
      Decorates the remapping function to record statistics if enabled.
      default <T,​U,​R>
      java.util.function.BiFunction<? super T,​? super U,​? extends R>
      statsAware​(java.util.function.BiFunction<? super T,​? super U,​? extends R> remappingFunction, boolean recordMiss, boolean recordLoad)
      Decorates the remapping function to record statistics if enabled.
      default java.util.function.Function<? super K,​? extends V> statsAware​(java.util.function.Function<? super K,​? extends V> mappingFunction, boolean recordLoad)
      Decorates the remapping function to record statistics if enabled.
      StatsCounter statsCounter()
      Returns the StatsCounter used by this cache.
      Ticker statsTicker()
      Returns the Ticker used by this cache for statistics.
      • Methods inherited from interface java.util.concurrent.ConcurrentMap

        computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
      • Methods inherited from interface java.util.Map

        clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
    • Method Detail

      • isRecordingStats

        boolean isRecordingStats()
        Returns whether this cache has statistics enabled.
      • hasRemovalListener

        boolean hasRemovalListener()
        Returns whether this cache notifies when an entry is removed.
      • notifyRemoval

        void notifyRemoval​(@Nullable
                           K key,
                           @Nullable
                           V value,
                           RemovalCause cause)
        Asynchronously sends a removal notification to the listener.
      • executor

        @Nonnull
        java.util.concurrent.Executor executor()
        Returns the Executor used by this cache.
      • hasWriteTime

        boolean hasWriteTime()
        Returns whether the cache captures the write time of the entry.
      • expirationTicker

        @Nonnull
        Ticker expirationTicker()
        Returns the Ticker used by this cache for expiration.
      • statsTicker

        @Nonnull
        Ticker statsTicker()
        Returns the Ticker used by this cache for statistics.
      • getIfPresent

        @Nullable
        V getIfPresent​(@Nonnull
                       java.lang.Object key,
                       boolean recordStats)
        See Cache.getIfPresent(Object). This method differs by accepting a parameter of whether to record the hit and miss statistics based on the success of this operation.
      • getIfPresentQuietly

        @Nullable
        V getIfPresentQuietly​(@Nonnull
                              java.lang.Object key,
                              @Nonnull
                              long[] writeTime)
        See Cache.getIfPresent(Object). This method differs by not recording the access with the statistics nor the eviction policy, and populates the write time if known.
      • put

        @Nullable
        V put​(@Nonnull
              K key,
              @Nonnull
              V value,
              boolean notifyWriter)
        See Cache.put(Object, Object). This method differs by allowing the operation to not notify the writer when an entry was inserted or updated.
      • compute

        default V compute​(K key,
                          java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)
        Specified by:
        compute in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        compute in interface java.util.Map<K,​V>
      • compute

        V compute​(K key,
                  java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                  boolean recordMiss,
                  boolean recordLoad)
        See ConcurrentMap.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>). This method differs by accepting parameters indicating whether to record miss and load statistics based on the success of this operation.
      • computeIfAbsent

        default V computeIfAbsent​(K key,
                                  java.util.function.Function<? super K,​? extends V> mappingFunction)
        Specified by:
        computeIfAbsent in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        computeIfAbsent in interface java.util.Map<K,​V>
      • computeIfAbsent

        V computeIfAbsent​(K key,
                          java.util.function.Function<? super K,​? extends V> mappingFunction,
                          boolean recordStats,
                          boolean recordLoad)
        See ConcurrentMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>). This method differs by accepting parameters indicating how to record statistics.
      • statsAware

        default java.util.function.Function<? super K,​? extends V> statsAware​(java.util.function.Function<? super K,​? extends V> mappingFunction,
                                                                                    boolean recordLoad)
        Decorates the remapping function to record statistics if enabled.
      • statsAware

        default <T,​U,​R> java.util.function.BiFunction<? super T,​? super U,​? extends R> statsAware​(java.util.function.BiFunction<? super T,​? super U,​? extends R> remappingFunction)
        Decorates the remapping function to record statistics if enabled.
      • statsAware

        default <T,​U,​R> java.util.function.BiFunction<? super T,​? super U,​? extends R> statsAware​(java.util.function.BiFunction<? super T,​? super U,​? extends R> remappingFunction,
                                                                                                                          boolean recordMiss,
                                                                                                                          boolean recordLoad)
        Decorates the remapping function to record statistics if enabled.