|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.util.MultiCache
public class MultiCache
A CacheMap-based cache.
It creates multiple instances of CacheMap, called
the internal caches, and then distributes the access across them.
Thus, the performance is porportional to the number of internal caches.
Thread safe.
| Field Summary |
|---|
| Fields inherited from interface org.zkoss.util.Cache |
|---|
DEFAULT_LIFETIME, DEFAULT_MAX_SIZE |
| Constructor Summary | |
|---|---|
MultiCache()
Constructs a multi cache with 17 inital caches. |
|
MultiCache(int nCache)
Constructs a multi cache with the specified number of internal caches. |
|
MultiCache(int nCache,
int initSize)
Deprecated. As of release 5.0.0, replaced with MultiCache(int) |
|
MultiCache(int nCache,
int maxSize,
int lifetime)
Constucts a multi cache with the specified number of internal caches, the max size and the lifetime. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears all objects being cached. |
Object |
clone()
|
boolean |
containsKey(Object key)
Returns whether the specified key is stored. |
Object |
get(Object key)
Returns the object of the specified key, or null if not found. |
int |
getLifetime()
Returns the minimal lifetime, unit=milliseconds. |
int |
getMaxSize()
Returns the maximal allowed size. |
Object |
put(Object key,
Object value)
Stores an object to the cache. |
Object |
remove(Object key)
Removes an object from the cache. |
void |
setLifetime(int lifetime)
Sets the minimal lifetime. |
void |
setMaxSize(int maxsize)
Sets the maximal allowed size. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiCache()
public MultiCache(int nCache,
int maxSize,
int lifetime)
nCache - the postive number of the internal caches.
The large the number the fast the performance.maxSize - the maximal allowed size of each cachepublic MultiCache(int nCache)
The default lifetime is Cache.DEFAULT_LIFETIME, and
the default maximal allowed size of each cache is
(Cache.DEFAULT_MAX_SIZE / 10).
nCache - the postive number of the internal caches.
The large the number the fast the performance.
public MultiCache(int nCache,
int initSize)
MultiCache(int)
| Method Detail |
|---|
public boolean containsKey(Object key)
Cache
containsKey in interface Cachepublic Object get(Object key)
Cache
get in interface Cache
public Object put(Object key,
Object value)
Cache
put in interface Cachepublic Object remove(Object key)
Cache
remove in interface Cachepublic void clear()
Cache
clear in interface Cachepublic int getLifetime()
Cache
getLifetime in interface CacheCache.getMaxSize()public void setLifetime(int lifetime)
CacheCache.DEFAULT_LIFETIME.
setLifetime in interface Cachelifetime - the lifetime, unit=milliseconds;
if non-posive, they will be removed immediately.Cache.getLifetime()public int getMaxSize()
CacheCache.DEFAULT_MAX_SIZE.
An mapping won't be removed by GC unless the minimal lifetime
or the maximal allowed size exceeds.
getMaxSize in interface CacheCache.getLifetime()public void setMaxSize(int maxsize)
Cache
setMaxSize in interface CacheCache.getMaxSize()public Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||