Interface LocalCache<K,V>

All Superinterfaces:
ConcurrentMap<K,V>, Map<K,V>
All Known Implementing Classes:
BoundedLocalCache, SI, SIA, SIAR, SIAW, SIAWR, SIL, SILA, SILAR, SILAW, SILAWR, SILMS, SILMSA, SILMSAR, SILMSAW, SILMSAWR, SILMSR, SILMSW, SILMSWR, SILMW, SILMWA, SILMWAR, SILMWAW, SILMWAWR, SILMWR, SILMWW, SILMWWR, SILR, SILS, SILSA, SILSAR, SILSAW, SILSAWR, SILSMS, SILSMSA, SILSMSAR, SILSMSAW, SILSMSAWR, SILSMSR, SILSMSW, SILSMSWR, SILSMW, SILSMWA, SILSMWAR, SILSMWAW, SILSMWAWR, SILSMWR, SILSMWW, SILSMWWR, SILSR, SILSW, SILSWR, SILW, SILWR, SIMS, SIMSA, SIMSAR, SIMSAW, SIMSAWR, SIMSR, SIMSW, SIMSWR, SIMW, SIMWA, SIMWAR, SIMWAW, SIMWAWR, SIMWR, SIMWW, SIMWWR, SIR, SIS, SISA, SISAR, SISAW, SISAWR, SISMS, SISMSA, SISMSAR, SISMSAW, SISMSAWR, SISMSR, SISMSW, SISMSWR, SISMW, SISMWA, SISMWAR, SISMWAW, SISMWAWR, SISMWR, SISMWW, SISMWWR, SISR, SISW, SISWR, SIW, SIWR, SS, SSA, SSAR, SSAW, SSAWR, SSL, SSLA, SSLAR, SSLAW, SSLAWR, SSLMS, SSLMSA, SSLMSAR, SSLMSAW, SSLMSAWR, SSLMSR, SSLMSW, SSLMSWR, SSLMW, SSLMWA, SSLMWAR, SSLMWAW, SSLMWAWR, SSLMWR, SSLMWW, SSLMWWR, SSLR, SSLS, SSLSA, SSLSAR, SSLSAW, SSLSAWR, SSLSMS, SSLSMSA, SSLSMSAR, SSLSMSAW, SSLSMSAWR, SSLSMSR, SSLSMSW, SSLSMSWR, SSLSMW, SSLSMWA, SSLSMWAR, SSLSMWAW, SSLSMWAWR, SSLSMWR, SSLSMWW, SSLSMWWR, SSLSR, SSLSW, SSLSWR, SSLW, SSLWR, SSMS, SSMSA, SSMSAR, SSMSAW, SSMSAWR, SSMSR, SSMSW, SSMSWR, SSMW, SSMWA, SSMWAR, SSMWAW, SSMWAWR, SSMWR, SSMWW, SSMWWR, SSR, SSS, SSSA, SSSAR, SSSAW, SSSAWR, SSSMS, SSSMSA, SSSMSAR, SSSMSAW, SSSMSAWR, SSSMSR, SSSMSW, SSSMSWR, SSSMW, SSSMWA, SSSMWAR, SSSMWAW, SSSMWAWR, SSSMWR, SSSMWW, SSSMWWR, SSSR, SSSW, SSSWR, SSW, SSWR, UnboundedLocalCache, WI, WIA, WIAR, WIAW, WIAWR, WIL, WILA, WILAR, WILAW, WILAWR, WILMS, WILMSA, WILMSAR, WILMSAW, WILMSAWR, WILMSR, WILMSW, WILMSWR, WILMW, WILMWA, WILMWAR, WILMWAW, WILMWAWR, WILMWR, WILMWW, WILMWWR, WILR, WILS, WILSA, WILSAR, WILSAW, WILSAWR, WILSMS, WILSMSA, WILSMSAR, WILSMSAW, WILSMSAWR, WILSMSR, WILSMSW, WILSMSWR, WILSMW, WILSMWA, WILSMWAR, WILSMWAW, WILSMWAWR, WILSMWR, WILSMWW, WILSMWWR, WILSR, WILSW, WILSWR, WILW, WILWR, WIMS, WIMSA, WIMSAR, WIMSAW, WIMSAWR, WIMSR, WIMSW, WIMSWR, WIMW, WIMWA, WIMWAR, WIMWAW, WIMWAWR, WIMWR, WIMWW, WIMWWR, WIR, WIS, WISA, WISAR, WISAW, WISAWR, WISMS, WISMSA, WISMSAR, WISMSAW, WISMSAWR, WISMSR, WISMSW, WISMSWR, WISMW, WISMWA, WISMWAR, WISMWAW, WISMWAWR, WISMWR, WISMWW, WISMWWR, WISR, WISW, WISWR, WIW, WIWR, WS, WSA, WSAR, WSAW, WSAWR, WSL, WSLA, WSLAR, WSLAW, WSLAWR, WSLMS, WSLMSA, WSLMSAR, WSLMSAW, WSLMSAWR, WSLMSR, WSLMSW, WSLMSWR, WSLMW, WSLMWA, WSLMWAR, WSLMWAW, WSLMWAWR, WSLMWR, WSLMWW, WSLMWWR, WSLR, WSLS, WSLSA, WSLSAR, WSLSAW, WSLSAWR, WSLSMS, WSLSMSA, WSLSMSAR, WSLSMSAW, WSLSMSAWR, WSLSMSR, WSLSMSW, WSLSMSWR, WSLSMW, WSLSMWA, WSLSMWAR, WSLSMWAW, WSLSMWAWR, WSLSMWR, WSLSMWW, WSLSMWWR, WSLSR, WSLSW, WSLSWR, WSLW, WSLWR, WSMS, WSMSA, WSMSAR, WSMSAW, WSMSAWR, WSMSR, WSMSW, WSMSWR, WSMW, WSMWA, WSMWAR, WSMWAW, WSMWAWR, WSMWR, WSMWW, WSMWWR, WSR, WSS, WSSA, WSSAR, WSSAW, WSSAWR, WSSMS, WSSMSA, WSSMSAR, WSSMSAW, WSSMSAWR, WSSMSR, WSSMSW, WSSMSWR, WSSMW, WSSMWA, WSSMWAR, WSSMWAW, WSSMWAWR, WSSMWR, WSSMWW, WSSMWWR, WSSR, WSSW, WSSWR, WSW, WSWR

interface LocalCache<K,V> extends ConcurrentMap<K,V>
An in-memory cache providing thread safety and atomicity guarantees. This interface provides an extension to ConcurrentMap for use with skeletal implementations.
  • Method Details

    • isRecordingStats

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

      @NonNull StatsCounter statsCounter()
      Returns the StatsCounter used by this cache.
    • hasRemovalListener

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

      RemovalListener<K,V> removalListener()
      Returns the RemovalListener used by this cache.
    • notifyRemoval

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

      @NonNull 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.
    • estimatedSize

      long estimatedSize()
    • getIfPresent

      @Nullable V getIfPresent(@NonNull 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 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.
    • getAllPresent

      @NonNull Map<K,V> getAllPresent(@NonNull Iterable<?> keys)
    • 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, BiFunction<? super K,? super V,? extends V> remappingFunction)
      Specified by:
      compute in interface ConcurrentMap<K,V>
      Specified by:
      compute in interface Map<K,V>
    • compute

      @Nullable V compute(K key, 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, Function<? super K,? extends V> mappingFunction)
      Specified by:
      computeIfAbsent in interface ConcurrentMap<K,V>
      Specified by:
      computeIfAbsent in interface Map<K,V>
    • computeIfAbsent

      @Nullable V computeIfAbsent(K key, 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.
    • invalidateAll

      default void invalidateAll(Iterable<?> keys)
    • cleanUp

      void cleanUp()
    • statsAware

      default <T, R> Function<? super T,? extends R> statsAware(Function<? super T,? extends R> mappingFunction, boolean recordLoad)
      Decorates the remapping function to record statistics if enabled.
    • statsAware

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

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