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 @Nullable V compute​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction)  
      @Nullable V compute​(K key, java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction, boolean recordMiss, boolean recordLoad, boolean recordLoadFailure)
      See ConcurrentMap.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>).
      default @Nullable V computeIfAbsent​(K key, java.util.function.Function<? super K,​? extends V> mappingFunction)  
      @Nullable 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()
      @NonNull java.util.concurrent.Executor executor()
      Returns the Executor used by this cache.
      @NonNull Ticker expirationTicker()
      Returns the Ticker used by this cache for expiration.
      @NonNull java.util.Map<K,​V> getAllPresent​(@NonNull java.lang.Iterable<?> keys)
      @Nullable V getIfPresent​(@NonNull java.lang.Object key, boolean recordStats)
      @Nullable V getIfPresentQuietly​(@NonNull java.lang.Object key, @org.checkerframework.checker.nullness.qual.NonNull 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​(@Nullable K key, @Nullable V value, RemovalCause cause)
      Asynchronously sends a removal notification to the listener.
      @Nullable V put​(@NonNull K key, @NonNull V value, boolean notifyWriter)
      RemovalListener<K,​V> removalListener()
      Returns the RemovalListener used by this cache.
      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, boolean recordLoadFailure)
      Decorates the remapping function to record statistics if enabled.
      default <T,​R>
      java.util.function.Function<? super T,​? extends R>
      statsAware​(java.util.function.Function<? super T,​? extends R> mappingFunction, boolean recordLoad)
      Decorates the remapping function to record statistics if enabled.
      @NonNull StatsCounter statsCounter()
      Returns the StatsCounter used by this cache.
      @NonNull 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,
                                        @org.checkerframework.checker.nullness.qual.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 @Nullable 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

        @Nullable V compute​(K key,
                            java.util.function.BiFunction<? super K,​? super V,​? extends V> remappingFunction,
                            boolean recordMiss,
                            boolean recordLoad,
                            boolean recordLoadFailure)
        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 @Nullable 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

        @Nullable 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 <T,​R> java.util.function.Function<? super T,​? extends R> statsAware​(java.util.function.Function<? super T,​? extends R> 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,
                                                                                                                          boolean recordLoadFailure)
        Decorates the remapping function to record statistics if enabled.