| java.lang.Object org.zkoss.util.ThreadLocalCache
ThreadLocalCache | public class ThreadLocalCache implements Cache(Code) | | A cache that resides on the thread local memory.
The performance is excellent since no need to synchronize the access.
However, it takes more memory since each thread has its own map.
author: tomyeh since: 3.0.0 |
Constructor Summary | |
public | ThreadLocalCache(int maxSize, int lifetime) Constucts a thread-local cache with the specified max size
and the lifetime. | public | ThreadLocalCache() Constructs a thread-local cache with the default setting:
max size=128 and lifetime=30minutes. |
ThreadLocalCache | public ThreadLocalCache(int maxSize, int lifetime)(Code) | | Constucts a thread-local cache with the specified max size
and the lifetime.
|
ThreadLocalCache | public ThreadLocalCache()(Code) | | Constructs a thread-local cache with the default setting:
max size=128 and lifetime=30minutes.
|
clear | public void clear()(Code) | | |
copyTo | public void copyTo(Map map)(Code) | | Puts all object cached in the current thread to the specifed map.
|
getLifetime | public int getLifetime()(Code) | | |
getMaxSize | public int getMaxSize()(Code) | | Returns the maximal allowed size.
Defalut: 128 (it is smaller than most cache since this cache
one per thread).
An mapping won't be removed by GC unless the minimal lifetime
or the maximal allowed size exceeds.
See Also: ThreadLocalCache.getLifetime |
isEmpty | public boolean isEmpty()(Code) | | Returns whether the cache for the current thread is empty.
|
setLifetime | public void setLifetime(int lifetime)(Code) | | |
setMaxSize | public void setMaxSize(int maxsize)(Code) | | |
|
|