Interface LocalCache<K,V>
-
- All Superinterfaces:
java.util.concurrent.ConcurrentMap<K,V>,java.util.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,SS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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 java.util.concurrent.ConcurrentMap<K,V>An in-memory cache providing thread safety and atomicity guarantees. This interface provides an extension toConcurrentMapfor use with skeletal implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcleanUp()SeeCache.cleanUp().default @Nullable Vcompute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)@Nullable Vcompute(K key, java.util.function.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>).default @Nullable VcomputeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)@Nullable VcomputeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction, boolean recordStats, boolean recordLoad)SeeConcurrentMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>).longestimatedSize()@NonNull java.util.concurrent.Executorexecutor()Returns theExecutorused by this cache.@NonNull TickerexpirationTicker()Returns theTickerused by this cache for expiration.@NonNull java.util.Map<K,V>getAllPresent(@NonNull java.lang.Iterable<?> keys)@Nullable VgetIfPresent(@NonNull java.lang.Object key, boolean recordStats)@Nullable VgetIfPresentQuietly(@NonNull java.lang.Object key, @org.checkerframework.checker.nullness.qual.NonNull long[] writeTime)booleanhasRemovalListener()Returns whether this cache notifies when an entry is removed.booleanhasWriteTime()Returns whether the cache captures the write time of the entry.default voidinvalidateAll(java.lang.Iterable<?> keys)booleanisRecordingStats()Returns whether this cache has statistics enabled.voidnotifyRemoval(@Nullable K key, @Nullable V value, RemovalCause cause)Asynchronously sends a removal notification to the listener.@Nullable Vput(@NonNull K key, @NonNull V value, boolean notifyWriter)RemovalListener<K,V>removalListener()Returns theRemovalListenerused 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 StatsCounterstatsCounter()Returns theStatsCounterused by this cache.@NonNull TickerstatsTicker()Returns theTickerused by this cache for statistics.
-
-
-
Method Detail
-
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
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 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.
-
estimatedSize
long estimatedSize()
-
getIfPresent
@Nullable V getIfPresent(@NonNull java.lang.Object key, boolean recordStats)
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 java.lang.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.
-
put
@Nullable V put(@NonNull K key, @NonNull V value, boolean notifyWriter)
SeeCache.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)
-
compute
@Nullable V compute(K key, java.util.function.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
default @Nullable V computeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)
-
computeIfAbsent
@Nullable V computeIfAbsent(K key, java.util.function.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
default void invalidateAll(java.lang.Iterable<?> keys)
-
cleanUp
void cleanUp()
SeeCache.cleanUp().
-
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.
-
-