public abstract class CacheBuilder<K,T> extends RootAnyBuilder<K,T> implements Cloneable
Modifier and Type | Field and Description |
---|---|
protected BulkCacheSource |
bulkCacheSource |
protected CacheSource |
cacheSource |
protected CacheSourceWithMetaInfo |
cacheSourceWithMetaInfo |
protected EntryExpiryCalculator |
entryExpiryCalculator |
protected ExceptionExpiryCalculator |
exceptionExpiryCalculator |
protected ExperimentalBulkCacheSource |
experimentalBulkCacheSource |
protected RefreshController |
refreshController |
config
root
Constructor and Description |
---|
CacheBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract Cache<K,T> |
build()
Builds a cache with the specified configuration parameters.
|
protected void |
ctor(Class<K> _keyType,
Class<T> _valueType,
Class<?> _entryType)
Builder is constructed from prototype
|
CacheBuilder<K,T> |
entryExpiryCalculator(EntryExpiryCalculator c)
Set expiry calculator to use.
|
CacheBuilder<K,T> |
eternal(boolean v)
Keep entries forever.
|
CacheBuilder<K,T> |
exceptionExpiryCalculator(ExceptionExpiryCalculator c)
Set expiry calculator to use in case of an exception happened in the
CacheSource . |
CacheBuilder<K,T> |
exceptionExpiryDuration(long v,
TimeUnit u)
Separate timeout in the case an exception was thrown in the cache source.
|
CacheBuilder<K,T> |
expiryDuration(long v,
TimeUnit u)
Set the time duration after an entry expires.
|
CacheBuilder<K,T> |
expiryMillis(long v)
Deprecated.
since 0.20, please use
expiryDuration(long, java.util.concurrent.TimeUnit) |
CacheBuilder<K,T> |
expirySecs(int v)
Deprecated.
since 0.20, please use
expiryDuration(long, java.util.concurrent.TimeUnit) |
CacheConfig |
getConfig()
Deprecated.
|
CacheBuilder<K,T> |
heapEntryCapacity(int v) |
CacheBuilder<K,T> |
implementation(Class<?> c) |
CacheBuilder<K,T> |
keepDataAfterExpired(boolean v) |
CacheBuilder<K,T> |
maxSize(int v) |
CacheBuilder<K,T> |
maxSizeBound(int v) |
CacheBuilder<K,T> |
name(Class<?> _class) |
CacheBuilder<K,T> |
name(Class<?> _class,
String _fieldName)
Constructs a cache name out of the simple class name and fieldname.
|
CacheBuilder<K,T> |
name(Object _containingObject,
String _fieldName)
Constructs a cache name out of the simple class name and fieldname.
|
CacheBuilder<K,T> |
name(String v) |
static <K,C extends Collection<T>,T> |
newCache(Class<K> _keyType,
Class<C> _collectionType,
Class<T> _entryType) |
static <K,T> CacheBuilder<K,T> |
newCache(Class<K> _keyType,
Class<T> _valueType) |
CacheBuilder<K,T> |
refreshController(RefreshController c)
Deprecated.
since 0.20, please use
entryExpiryCalculator |
CacheBuilder<K,T> |
source(BulkCacheSource<K,T> g) |
CacheBuilder<K,T> |
source(CacheSource<K,T> g) |
CacheBuilder<K,T> |
source(CacheSourceWithMetaInfo<K,T> g) |
CacheBuilder<K,T> |
source(ExperimentalBulkCacheSource<K,T> g) |
CacheBuilder<K,T> |
suppressExceptions(boolean v)
If an exceptions gets thrown by the cache source, suppress it if there is
a previous value.
|
backgroundRefresh, createConfiguration, persistence, sharpExpiry
root
protected EntryExpiryCalculator entryExpiryCalculator
protected CacheSource cacheSource
protected CacheSourceWithMetaInfo cacheSourceWithMetaInfo
protected RefreshController refreshController
protected ExperimentalBulkCacheSource experimentalBulkCacheSource
protected BulkCacheSource bulkCacheSource
protected ExceptionExpiryCalculator exceptionExpiryCalculator
public CacheBuilder()
public static <K,T> CacheBuilder<K,T> newCache(Class<K> _keyType, Class<T> _valueType)
public static <K,C extends Collection<T>,T> CacheBuilder<K,C> newCache(Class<K> _keyType, Class<C> _collectionType, Class<T> _entryType)
protected void ctor(Class<K> _keyType, Class<T> _valueType, Class<?> _entryType)
public CacheBuilder<K,T> name(Class<?> _class, String _fieldName)
public CacheBuilder<K,T> name(Class<?> _class)
public CacheBuilder<K,T> name(Object _containingObject, String _fieldName)
public CacheBuilder<K,T> name(String v)
public CacheBuilder<K,T> keepDataAfterExpired(boolean v)
public CacheBuilder<K,T> maxSize(int v)
public CacheBuilder<K,T> maxSizeBound(int v)
public CacheBuilder<K,T> eternal(boolean v)
public CacheBuilder<K,T> suppressExceptions(boolean v)
public CacheBuilder<K,T> heapEntryCapacity(int v)
public CacheBuilder<K,T> expiryDuration(long v, TimeUnit u)
eternal(boolean)
. A value of 0 effectively
disables the cache.
If an EntryExpiryCalculator
is set, this setting
controls the maximum possible expiry duration.public CacheBuilder<K,T> exceptionExpiryDuration(long v, TimeUnit u)
public CacheBuilder<K,T> expirySecs(int v)
expiryDuration(long, java.util.concurrent.TimeUnit)
public CacheBuilder<K,T> expiryMillis(long v)
expiryDuration(long, java.util.concurrent.TimeUnit)
public CacheBuilder<K,T> source(CacheSource<K,T> g)
public CacheBuilder<K,T> source(CacheSourceWithMetaInfo<K,T> g)
public CacheBuilder<K,T> source(ExperimentalBulkCacheSource<K,T> g)
public CacheBuilder<K,T> source(BulkCacheSource<K,T> g)
public CacheBuilder<K,T> entryExpiryCalculator(EntryExpiryCalculator c)
expiryDuration(long, java.util.concurrent.TimeUnit)
is set to 0 then expiry calculation is not used, all entries expire immediately.public CacheBuilder<K,T> exceptionExpiryCalculator(ExceptionExpiryCalculator c)
CacheSource
.public CacheBuilder<K,T> refreshController(RefreshController c)
entryExpiryCalculator
public CacheBuilder<K,T> implementation(Class<?> c)
@Deprecated public CacheConfig getConfig()
public abstract Cache<K,T> build()
build
in interface AnyBuilder<K,T,CacheConfig>
build
in class BaseAnyBuilder<K,T,CacheConfig>
cache2k API documentation. Copyright © 2000–2016 headissue GmbH, Munich.