|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.gwt.user.client.Cache
public class Cache
Generic object cache that can be used to optimize the JavaScript execution. The cached objects are stored in a map and a reference to this map is saved as a property of a DOM element. Anyone who has access to the underlying DOM element has access to the cache.
| Nested Class Summary | |
|---|---|
static interface |
Cache.CacheCallback<T>
Interface used to access an object when it is not found in the cache. |
| Constructor Summary | |
|---|---|
Cache(com.google.gwt.core.client.JavaScriptObject cacheHolder)
Creates a new cache that uses the given JavaScript object to store the cached objects. |
|
| Method Summary | ||
|---|---|---|
void |
clear(boolean disable)
Clears the cache and optionally disables it. |
|
|
get(String key,
Cache.CacheCallback<T> callback)
Looks up the given key in the cache and returns the associated object if the key if found. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Cache(com.google.gwt.core.client.JavaScriptObject cacheHolder)
cacheHolder - the JavaScript object that holds the map with the cached objects| Method Detail |
|---|
public <T> T get(String key,
Cache.CacheCallback<T> callback)
T - the type of the cached objectkey - the key that identifies the requested object in the cachecallback - the call-back used to retrieve the requested object when it is not found in the cache
public void clear(boolean disable)
disable - true to disable the cache, false to enable the cache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||