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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,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
An in-memory cache providing thread safety and atomicity guarantees. This interface provides an
extension to
ConcurrentMap for use with skeletal implementations.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp()SeeCache.cleanUp().default @Nullable V@Nullable Vcompute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, boolean recordMiss, boolean recordLoad, boolean recordLoadFailure) default @Nullable VcomputeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) @Nullable VcomputeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, boolean recordStats, boolean recordLoad) long@NonNull Executorexecutor()Returns theExecutorused by this cache.@NonNull TickerReturns theTickerused by this cache for expiration.getAllPresent(@NonNull Iterable<?> keys) @Nullable VgetIfPresent(@NonNull Object key, boolean recordStats) @Nullable VgetIfPresentQuietly(@NonNull Object key, @org.checkerframework.checker.nullness.qual.NonNull long[] writeTime) booleanReturns whether this cache notifies when an entry is removed.booleanReturns whether the cache captures the write time of the entry.default voidinvalidateAll(Iterable<?> keys) booleanReturns whether this cache has statistics enabled.voidnotifyRemoval(@Nullable K key, @Nullable V value, RemovalCause cause) Asynchronously sends a removal notification to the listener.@Nullable VReturns theRemovalListenerused by this cache.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.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.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.@NonNull StatsCounterReturns theStatsCounterused by this cache.@NonNull TickerReturns theTickerused by this cache for statistics.Methods inherited from interface java.util.concurrent.ConcurrentMap
computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
isRecordingStats
boolean isRecordingStats()Returns whether this cache has statistics enabled. -
statsCounter
@NonNull StatsCounter statsCounter()Returns theStatsCounterused by this cache. -
hasRemovalListener
boolean hasRemovalListener()Returns whether this cache notifies when an entry is removed. -
removalListener
RemovalListener<K,V> removalListener()Returns theRemovalListenerused by this cache. -
notifyRemoval
Asynchronously sends a removal notification to the listener. -
executor
@NonNull Executor executor()Returns theExecutorused by this cache. -
hasWriteTime
boolean hasWriteTime()Returns whether the cache captures the write time of the entry. -
expirationTicker
@NonNull Ticker expirationTicker()Returns theTickerused by this cache for expiration. -
statsTicker
@NonNull Ticker statsTicker()Returns theTickerused by this cache for statistics. -
estimatedSize
long estimatedSize() -
getIfPresent
SeeCache.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) SeeCache.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
-
put
SeeCache.put(Object, Object). This method differs by allowing the operation to not notify the writer when an entry was inserted or updated. -
compute
-
compute
@Nullable V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, boolean recordMiss, boolean recordLoad, boolean recordLoadFailure) SeeConcurrentMap.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
- Specified by:
computeIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfAbsent
@Nullable V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, boolean recordStats, boolean recordLoad) SeeConcurrentMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>). This method differs by accepting parameters indicating how to record statistics. -
invalidateAll
-
cleanUp
void cleanUp()SeeCache.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, BiFunction<? super T,R> ? super U, statsAware? extends R> (BiFunction<? super T, ? super U, ? extends R> remappingFunction) Decorates the remapping function to record statistics if enabled. -
statsAware
default <T,U, BiFunction<? super T,R> ? super U, statsAware? extends R> (BiFunction<? super T, ? super U, ? extends R> remappingFunction, boolean recordMiss, boolean recordLoad, boolean recordLoadFailure) Decorates the remapping function to record statistics if enabled.
-