|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.util.CacheMap
org.zkoss.util.resource.ResourceCache
public class ResourceCache
Used to cache resouces.
To use this class, you have to implement Loader and then
ResourceCache will use it to check whether a resource is gone,
modified and load the resource.
Unlike CacheMap, it is thread-safe.
The default check period depends on the system propety called org.zkoss.util.resource.checkPeriod (unit: second). If not specified, 5 seconds are assumed
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.zkoss.util.CacheMap |
|---|
CacheMap.Value |
| Field Summary | |
|---|---|
protected Loader |
_loader
The loader. |
| Fields inherited from class org.zkoss.util.CacheMap |
|---|
DEFAULT_LIFETIME, DEFAULT_MAXSIZE, EXPUNGE_CONTINUE, EXPUNGE_NO, EXPUNGE_STOP, EXPUNGE_YES |
| Constructor Summary | |
|---|---|
ResourceCache(Loader loader)
Constructor. |
|
ResourceCache(Loader loader,
int initsz)
Constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
It is OK to clear up all cached resources if you don't want to cache it. |
java.lang.Object |
get(java.lang.Object src)
Returns the resource, or null if not found. |
int |
getCheckPeriod()
Returns how often to check (unit=milliseconds). |
Loader |
getLoader()
Returns the loader. |
java.lang.Object |
put(java.lang.Object src,
java.lang.Object val)
Don't use it. |
java.lang.Object |
remove(java.lang.Object src)
It is OK to remove the resource if you don't want to cache it. |
ResourceCache |
setCheckPeriod(int checkPeriod)
Sets how often to check (unit=milliseconds). |
| Methods inherited from class org.zkoss.util.CacheMap |
|---|
canExpunge, clone, containsKey, containsValue, entrySet, equals, getLifetime, getMaxSize, getWithoutExpunge, hashCode, isEmpty, keySet, newQueue, onExpunge, putAll, setLifetime, setMaxSize, shallExpunge, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Loader _loader
| Constructor Detail |
|---|
public ResourceCache(Loader loader)
loader - the loader to load resource
public ResourceCache(Loader loader,
int initsz)
loader - the loader to load resourceinitsz - the initial size of the map| Method Detail |
|---|
public Loader getLoader()
public int getCheckPeriod()
Default: 300000
public ResourceCache setCheckPeriod(int checkPeriod)
public java.lang.Object get(java.lang.Object src)
get in interface java.util.Mapget in class CacheMap
public java.lang.Object put(java.lang.Object src,
java.lang.Object val)
put in interface java.util.Mapput in class CacheMappublic java.lang.Object remove(java.lang.Object src)
remove in interface java.util.Mapremove in class CacheMappublic void clear()
clear in interface java.util.Mapclear in class CacheMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||