Class LoadingCacheProxy<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.jcache.CacheProxy<K,V>
-
- com.github.benmanes.caffeine.jcache.LoadingCacheProxy<K,V>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<javax.cache.Cache.Entry<K,V>>
,javax.cache.Cache<K,V>
public final class LoadingCacheProxy<K,V> extends CacheProxy<K,V>
An implementation of JSR-107Cache
backed by a Caffeine loading cache.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.benmanes.caffeine.jcache.CacheProxy
CacheProxy.EntryIterator, CacheProxy.NullCompletionListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LoadingCache<K,Expirable<V>>
cache
-
Fields inherited from class com.github.benmanes.caffeine.jcache.CacheProxy
cacheLoader, cacheManager, cacheMXBean, closed, configuration, copier, dispatcher, executor, expiry, inFlight, name, statistics, ticker, writer
-
-
Constructor Summary
Constructors Constructor Description LoadingCacheProxy(java.lang.String name, java.util.concurrent.Executor executor, javax.cache.CacheManager cacheManager, CaffeineConfiguration<K,V> configuration, LoadingCache<K,Expirable<V>> cache, EventDispatcher<K,V> dispatcher, javax.cache.integration.CacheLoader<K,V> cacheLoader, javax.cache.expiry.ExpiryPolicy expiry, Ticker ticker, JCacheStatisticsMXBean statistics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable V
get(K key)
java.util.Map<K,V>
getAll(java.util.Set<? extends K> keys)
private java.util.Map<K,V>
getAll(java.util.Set<? extends K> keys, boolean updateAccessTime)
Returns the entries, loading if necessary, and optionally updates their access expiry time.private @Nullable V
getOrLoad(K key)
Retrieves the value from the cache, loading it if necessary.void
loadAll(java.util.Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
-
Methods inherited from class com.github.benmanes.caffeine.jcache.CacheProxy
clear, close, containsKey, copyMap, copyOf, copyValue, currentTimeMillis, deregisterCacheEntryListener, enableManagement, enableStatistics, getAndFilterExpiredEntries, getAndPut, getAndRemove, getAndReplace, getCacheManager, getConfiguration, getConfiguration, getName, getWriteExpireTimeMS, invoke, invokeAll, isClosed, iterator, nanosToMillis, put, putAll, putIfAbsent, putNoCopyOrAwait, registerCacheEntryListener, remove, remove, removeAll, removeAll, replace, replace, requireNotClosed, setAccessExpirationTime, unwrap
-
-
-
-
Field Detail
-
cache
final LoadingCache<K,Expirable<V>> cache
-
-
Constructor Detail
-
LoadingCacheProxy
public LoadingCacheProxy(java.lang.String name, java.util.concurrent.Executor executor, javax.cache.CacheManager cacheManager, CaffeineConfiguration<K,V> configuration, LoadingCache<K,Expirable<V>> cache, EventDispatcher<K,V> dispatcher, javax.cache.integration.CacheLoader<K,V> cacheLoader, javax.cache.expiry.ExpiryPolicy expiry, Ticker ticker, JCacheStatisticsMXBean statistics)
-
-
Method Detail
-
getOrLoad
private @Nullable V getOrLoad(K key)
Retrieves the value from the cache, loading it if necessary.
-
getAll
private java.util.Map<K,V> getAll(java.util.Set<? extends K> keys, boolean updateAccessTime)
Returns the entries, loading if necessary, and optionally updates their access expiry time.
-
-