K
- key typeV
- value typepublic interface Cache<K,V>
Modifier and Type | Interface and Description |
---|---|
static interface |
Cache.Loader<KK,VV>
Loader to get the value for the key into the cache.
|
static interface |
Cache.RemovalListener<KK,VV>
Listener for removals from the cache.
|
static class |
Cache.RemovalNotification<KK,VV>
Notification of a removal from the cache.
|
static interface |
Cache.Statistics
Interface for providing cache statistics, if enabled.
|
static class |
Cache.UncheckedExecutionException
Exception was thrown while getting the cache value.
|
static interface |
Cache.Weigher<KK,VV>
Weigher for determining the weight of an entry.
|
Modifier and Type | Method and Description |
---|---|
ConcurrentMap<K,V> |
asMap()
Provide a view into the cache as a
Map . |
void |
cleanUp()
Run cache clean-up, e.g.
|
V |
getIfPresent(K key)
Get the value for the key if it exists in the cache, otherwise return null.
|
Cache.Statistics |
getStatistics()
Returns statistics, if enabled.
|
void |
invalidate(K key)
Invalidate a single cache entry.
|
void |
invalidateAll()
Invalidate all cache entries.
|
void |
put(K key,
V value)
Put the value for the key into the cache.
|
V getIfPresent(K key)
key
- keyvoid put(K key, V value)
key
- keyvalue
- valuevoid invalidateAll()
void invalidate(K key)
key
- key for the entry to be invalidatedvoid cleanUp()
ConcurrentMap<K,V> asMap()
Map
.Cache.Statistics getStatistics()
Copyright © 2016–2023. All rights reserved.