Package org.jdbi.v3.cache.noop
Class NoopCache<K,V>
- java.lang.Object
-
- org.jdbi.v3.cache.noop.NoopCache<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private JdbiCacheLoader<K,V>cacheLoader(package private) static java.lang.ObjectNOOP_CACHE_STATS
-
Constructor Summary
Constructors Constructor Description NoopCache(JdbiCacheLoader<K,V> cacheLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JdbiCacheBuilderbuilder()Returns a newJdbiCacheBuilderwhich can be used to construct the internal caches.Vget(K key)Returns the cached value for a key.java.lang.ObjectgetStats()Return implementation specific statistics for the cache object.VgetWithLoader(K key, JdbiCacheLoader<K,V> loader)Returns a cached value for a key.
-
-
-
Field Detail
-
NOOP_CACHE_STATS
static final java.lang.Object NOOP_CACHE_STATS
-
cacheLoader
private final JdbiCacheLoader<K,V> cacheLoader
-
-
Constructor Detail
-
NoopCache
NoopCache(JdbiCacheLoader<K,V> cacheLoader)
-
-
Method Detail
-
builder
public static JdbiCacheBuilder builder()
Returns a newJdbiCacheBuilderwhich can be used to construct the internal caches.- Returns:
- A
JdbiCacheBuilderinstance.
-
get
public V get(K key)
Description copied from interface:JdbiCacheReturns the cached value for a key.
-
getWithLoader
public V getWithLoader(K key, JdbiCacheLoader<K,V> loader)
Description copied from interface:JdbiCacheReturns a cached value for a key. If no value is cached, create a new value using the provided cache loader.- Specified by:
getWithLoaderin interfaceJdbiCache<K,V>- Parameters:
key- The key value. Must not be null.loader- AJdbiCacheLoaderimplementation. May be called with the provided key value.- Returns:
- The cached value or null if no value was cached.
-
getStats
public java.lang.Object getStats()
Description copied from interface:JdbiCacheReturn implementation specific statistics for the cache object. This can be used to expose statistic information about the underlying implementation.
-
-