K
- V
- public interface ICache<K,V>
Modifier and Type | Method and Description |
---|---|
void |
addListener(ICacheListener<V> listener)
Add a listener for changes to the cache.
|
void |
clear()
Clear all elements from cache.
|
V |
get(K key)
Get value based on a given key.
|
int |
getElementCount()
Get count of elements currently in cache.
|
long |
getHitCount()
Get the number of cache hits.
|
long |
getRequestCount()
Get the number of requests made to the cache.
|
CacheType |
getType()
Get the cache type.
|
void |
put(K key,
V value)
Add or replace value for the given key.
|
void |
remove(K key)
Remove an element from the cache.
|
CacheType getType()
V get(K key) throws SiteWhereException
key
- unique keySiteWhereException
- if implementation can not get valuevoid put(K key, V value) throws SiteWhereException
key
- unique keyvalue
- new or replacement valueSiteWhereException
- if implementation can not put valuevoid remove(K key) throws SiteWhereException
key
- unique key for object to removeSiteWhereException
- if implementation can not remove valuevoid addListener(ICacheListener<V> listener) throws SiteWhereException
listener
- SiteWhereException
void clear() throws SiteWhereException
SiteWhereException
- if implementation can not clear cacheint getElementCount() throws SiteWhereException
SiteWhereException
- if implementation can not get countlong getRequestCount() throws SiteWhereException
SiteWhereException
- if implementation can not get countlong getHitCount() throws SiteWhereException
SiteWhereException
- if implementation can not count hits