Y
- the lookup keyX
- the type of the items in the cache.public abstract class AbstractCache<Y,X>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_CACHE_ON
by default, use caching.
|
static long |
DEFAULT_CACHE_TTL
by default leave items in the cache this long.
|
static int |
DEFAULT_CONCURRENCY_LEVEL
default concurrency level
|
static int |
DEFAULT_MAX_CACHE_SIZE
by default, allow this many items in the cache.
|
static int |
DEFAULT_START_CACHE_SIZE
default initial cache size
|
Constructor and Description |
---|
AbstractCache() |
AbstractCache(int concurrencyLevel,
int cacheStartSize,
int cacheMaxSize,
long ttl) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
CacheEntry<X> |
get(java.lang.Object key) |
java.util.Set<Y> |
keySet() |
abstract void |
merge(Y key,
X doc,
X returnedResult)
merge the doc into the current cached item, if it exists.
|
void |
put(Y key,
CacheEntry<X> doc) |
void |
remove(java.lang.Object key) |
void |
removeAll(java.lang.Iterable<?> keys) |
void |
setCacheMode(boolean mode)
Enables or disables the cache.
|
public static final boolean DEFAULT_CACHE_ON
public static final long DEFAULT_CACHE_TTL
public static final int DEFAULT_START_CACHE_SIZE
public static final int DEFAULT_MAX_CACHE_SIZE
public static final int DEFAULT_CONCURRENCY_LEVEL
public AbstractCache(int concurrencyLevel, int cacheStartSize, int cacheMaxSize, long ttl)
concurrencyLevel
- cache concurreny levelcacheStartSize
- starting cache sizecacheMaxSize
- the initial size of the cache.ttl
- expiration time for cache entries in millisecondspublic AbstractCache()
public void put(Y key, CacheEntry<X> doc)
public void remove(java.lang.Object key)
public void removeAll(java.lang.Iterable<?> keys)
public abstract void merge(Y key, X doc, X returnedResult)
key
- the key into the cachedoc
- the changed itemsreturnedResult
- the returned resultpublic CacheEntry<X> get(java.lang.Object key)
public void setCacheMode(boolean mode)
mode
- true if the cache should be enabled. False otherwise.public java.util.Set<Y> keySet()
public void clear()
Copyright © 2010 - 2020 Adobe. All Rights Reserved