|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Cache
This is a cache which can be used to store data.
This is an abstraction of the general concept of a cache.
A Cache holds objects with keys with a limited lifespan and stores them based on the underlying implementation. This cache interface adheres to the JSR-107 spec.
| Method Summary | |
|---|---|
void |
clear()
Clear out all cached items from this cache. |
boolean |
exists(String key)
Check if a key exists in the cache. |
Object |
get(String key)
Gets an object from the cache if it can be found (maybe be a null). |
CacheConfig |
getConfig()
Returns a readable object which has the configuration used by this cache in it. |
List<String> |
getKeys()
Provides a method for finding out what keys are currently in the cache or getting all items out of the cache. |
String |
getName()
Get the unique name which identifies this cache. |
Object |
look(String key)
Gets an object from the cache without causing it to be refreshed or renewed. |
void |
put(String key,
Object value)
Puts an object in the cache which is identified by this key. |
boolean |
remove(String key)
Removes an object from the cache if it exists or does nothing if it does not. |
int |
size()
How many items does this cache hold? |
| Method Detail |
|---|
String getName()
void put(String key,
Object value)
key - the key for an item in the cachevalue - an object (this can be a null, e.g. to cache a miss)
IllegalArgumentException - if the cache name is invalid or cacheName or key is nullObject get(String key)
key - the key for an item in the cache
IllegalArgumentException - if any arguments are nullList<String> getKeys()
NOTE: that this is actually quite costly in most cases and should
only be used when really needed. It is much better to fetch the
items you actually need directly using get(String).
Object look(String key)
get(String) except that it keeps the
cache from refreshing the item that was retrieved.
key - the key for an item in the cache
IllegalArgumentException - if any arguments are nullget(String)boolean remove(String key)
key - the key for an item in the cache
IllegalArgumentException - if any arguments are nullboolean exists(String key)
key - the key for an item in the cache
IllegalArgumentException - if any arguments are nullint size()
void clear()
CacheConfig getConfig()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||