public interface Cache<K,V> extends StatisticsSource, StatusSource
Modifier and Type | Method and Description |
---|---|
void |
addObject(K pKey,
V pValue)
Add a new object to the cache.
|
void |
expireObject(K pKey)
Expire an object in the cache.
|
void |
flushCache()
This method will flush all objects from the cache.
|
String |
getCacheType() |
Iterable<K> |
getKeys()
Returns all the keys in the cache
|
int |
getMaxSize()
Get the max number of cached objects in this cache.
|
V |
getObject(K pKey)
Get an object from the cache.
|
int |
getSize()
Returns the current size of the cache.
|
int |
getValidSeconds()
Get the validSeconds for this cache.
|
boolean |
hasObject(K pKey)
Check if the cache contains the object while not changing any of
the cache statistics.
|
void |
remove(CacheFilter<K,V> pFilter)
Iterates through all the items in the cache and removes all items that is not accepted by the given filter.
|
getStatistic, getStatisticKeys
getReport, reset
String getCacheType()
int getMaxSize()
int getValidSeconds()
V getObject(K pKey)
pKey
- The key identifying the object to retrieveboolean hasObject(K pKey)
pKey
- The key identifying the objectpKey
. False otherwisevoid addObject(K pKey, V pValue)
pKey
- The identifier of the object to add.pValue
- The object being added to the cache.void expireObject(K pKey)
pKey
- The identifier of the object to expire.void flushCache()
int getSize()
getMaxSize
Iterable<K> getKeys()
Iterable
containing all the keys in the cachevoid remove(CacheFilter<K,V> pFilter)
pFilter
- the filter to apply to each item in the cache© 1998- 2018 Stibo DX