On 5/12/11 4:03 PM, yangjun2 wrote:
> Which case to more than one cache object per thread? It's only a class object
> , why use more than one?
The class argument is to specify the type of objects that will be cached.
For example:
private static final ThreadCache.CachedTypeIndex<Request> CACHE_IDX =
ThreadCache.obtainIndex(SomeThing.class, 16);
The above statement defines the cache.
Once defined, you can make calls like:
ThreadCache.takeFromCache(CACHE_IDX); // obtain a cached instance
ThreadCache.putToCache(CACHE_IDX, <Instance of Something>); // push
an instance to the cache
In the example above, the cache will never grow above 16 cached instances.
Does this clarify things?
> yang jun
> Best Regards
>
> --
> View this message in context: http://grizzly.1045725.n5.nabble.com/What-s-mean-of-size-parameter-tp4381294p4391761.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.