Package org.jdbi.v3.core.cache.internal
Class DefaultJdbiCacheBuilder
- java.lang.Object
-
- org.jdbi.v3.core.cache.internal.DefaultJdbiCacheBuilder
-
- All Implemented Interfaces:
JdbiCacheBuilder
public final class DefaultJdbiCacheBuilder extends java.lang.Object implements JdbiCacheBuilder
Builder for the default Jdbi cache implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private intmaxSize
-
Constructor Summary
Constructors Modifier Constructor Description privateDefaultJdbiCacheBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
JdbiCache<K,V>build()Creates an cache instance from the values in the builder.static DefaultJdbiCacheBuilderbuilder()Returns a new Builder.<K,V>
JdbiCache<K,V>buildWithLoader(JdbiCacheLoader<K,V> loader)Creates an cache instance from the values in the builder and a supplied cache loader.(package private) intgetMaxSize()DefaultJdbiCacheBuildermaxSize(int maxSize)Sets an upper boundary to the cache size.
-
-
-
Method Detail
-
builder
public static DefaultJdbiCacheBuilder builder()
Returns a new Builder.- Returns:
- A new builder instance for a
DefaultJdbiCacheinstance.
-
build
public <K,V> JdbiCache<K,V> build()
Description copied from interface:JdbiCacheBuilderCreates an cache instance from the values in the builder.- Specified by:
buildin interfaceJdbiCacheBuilder- Returns:
- A cache instance.
-
buildWithLoader
public <K,V> JdbiCache<K,V> buildWithLoader(JdbiCacheLoader<K,V> loader)
Description copied from interface:JdbiCacheBuilderCreates an cache instance from the values in the builder and a supplied cache loader.- Specified by:
buildWithLoaderin interfaceJdbiCacheBuilder- Parameters:
loader- AJdbiCacheLoaderinstance that is used to create a new value if no value is currently stored in the cache.
-
maxSize
public DefaultJdbiCacheBuilder maxSize(int maxSize)
Description copied from interface:JdbiCacheBuilderSets an upper boundary to the cache size.- Specified by:
maxSizein interfaceJdbiCacheBuilder- Parameters:
maxSize- Sets the maximum size of the cache. If the value is zero or negative, the cache is unbounded.- Returns:
- The instance of the builder itself.
-
getMaxSize
int getMaxSize()
-
-