public interface Cache<K,V>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LIFETIME
The default minimal lifetime, unit=milliseconds.
|
static int |
DEFAULT_MAX_SIZE
The default maximal allowed size.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all objects being cached.
|
boolean |
containsKey(java.lang.Object key)
Returns whether the specified key is stored.
|
V |
get(java.lang.Object key)
Returns the object of the specified key, or null if not found.
|
int |
getLifetime()
Returns the minimal lifetime, unit=milliseconds.
|
int |
getMaxSize()
Returns the maximal allowed size.
|
V |
put(K key,
V value)
Stores an object to the cache.
|
V |
remove(java.lang.Object key)
Removes an object from the cache.
|
void |
setLifetime(int lifetime)
Sets the minimal lifetime.
|
void |
setMaxSize(int maxsize)
Sets the maximal allowed size.
|
static final int DEFAULT_LIFETIME
static final int DEFAULT_MAX_SIZE
boolean containsKey(java.lang.Object key)
V get(java.lang.Object key)
V put(K key, V value)
V remove(java.lang.Object key)
void clear()
int getLifetime()
getMaxSize()
void setLifetime(int lifetime)
DEFAULT_LIFETIME
.lifetime
- the lifetime, unit=milliseconds;
if non-positive, they will be removed immediately.getLifetime()
int getMaxSize()
DEFAULT_MAX_SIZE
.
An mapping won't be removed by GC unless the minimal lifetime
or the maximal allowed size exceeds.getLifetime()
void setMaxSize(int maxsize)
getMaxSize()
Copyright © 2005-2018 Potix Corporation. All Rights Reserved.