@Internal
public interface ManagedCache
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the cache.
|
Long |
currentExpireAfterAccessMillis() |
Long |
currentExpireAfterWriteMillis() |
Integer |
currentMaxEntries() |
default com.atlassian.instrumentation.caches.CacheCollector |
getCacheCollector()
Returns the collector for this cache.
|
String |
getName()
The name of the cache, uniquely identifies this cache.
|
SortedMap<CacheStatisticsKey,Supplier<Long>> |
getStatistics()
Get usage statistics for the cache.
|
boolean |
isFlushable()
Returns true if this cache can be safely flushed any time.
|
boolean |
isLocal() |
boolean |
isReplicateAsynchronously() |
boolean |
isReplicateViaCopy() |
boolean |
isStatisticsEnabled() |
void |
setStatistics(boolean enabled)
Deprecated.
Use
CacheCollector.setEnabled(boolean) instead for
memory caches. This method was never implemented for other cache types. |
boolean |
updateExpireAfterAccess(long expireAfter,
TimeUnit timeUnit)
Attempts to update the hint regarding how long entries that should be held in the cache, after last access.
|
boolean |
updateExpireAfterWrite(long expireAfter,
TimeUnit timeUnit)
Attempts to update the hint regarding how long entries that should be held in the cache, after last write.
|
boolean |
updateMaxEntries(int newValue)
Attempts to update the hint regarding the maximum number of entries that should be cached at any time.
|
void clear()
@Nonnull String getName()
boolean isFlushable()
This method is used by CacheManager.flushCaches() to only flush caches that can be safely flushed. clear() ignores this value.
@Nullable Integer currentMaxEntries()
boolean updateMaxEntries(int newValue)
newValue - the new hint value@Nullable Long currentExpireAfterAccessMillis()
boolean updateExpireAfterAccess(long expireAfter,
@Nonnull
TimeUnit timeUnit)
expireAfter - Time to retain entries for since their last access.timeUnit - The TimeUnit for the time@Nullable Long currentExpireAfterWriteMillis()
boolean updateExpireAfterWrite(long expireAfter,
@Nonnull
TimeUnit timeUnit)
expireAfter - Time to retain entries for since their last write.timeUnit - The TimeUnit for the timeboolean isLocal()
boolean isReplicateAsynchronously()
boolean isReplicateViaCopy()
boolean isStatisticsEnabled()
@Deprecated void setStatistics(boolean enabled)
CacheCollector.setEnabled(boolean) instead for
memory caches. This method was never implemented for other cache types.enabled - The stats collection is enabled if true - disabled otherwise.@Nonnull SortedMap<CacheStatisticsKey,Supplier<Long>> getStatistics()
The statistics are sorted by the cache statistics key labels. Providing
statistics is an optional feature and no assumptions should be made by the caller about which (if any) statistics
will be returned.
@Nullable default com.atlassian.instrumentation.caches.CacheCollector getCacheCollector()
CacheCollector for this cache.Copyright © 2018 Atlassian. All rights reserved.