There is no method to get the size in bytes.  You can only approximate.
The admin bean used by the JCSAdmin.jsp writes the objects to a counting
output stream to get a rough idea of how much memory a region is using,
but there is no way to configure the cache to limit the size in bytes of
a region.

There is no way to accurately determine how much memory an object takes,
at least no way to get close that would not be too expensive to use.

We could put some limits on the cache using the memory size fuctions
available in the System class in jdk1.4, but this still wouldn't give
you the control you want.

Aaron


> -----Original Message-----
> From: Hoying, Ken [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 23, 2005 1:53 PM
> To: jcs-users@jakarta.apache.org
> Subject: Cache Size
> 
> 
> I am trying to tune my cache settings.  In particular the number of
> objects that I want to allow in the cache.  I would like to determine
how
> large my cache is in bytes while debugging so that I can set the max
> number of elements in the cache appropriately.  The API seems to
indicate
> that I can get the size of an item in the cache with the getSize()
method.
> However, this is not working for me.  I always get 0.  What am I doing
> wrong?
> 
> BTW..  I am using the LRUMemoryCache.
> 
> Thanks in advance,
> Ken
> 
> 
> **************************************************************
> This message, including any attachments, contains confidential
information
> intended for a specific individual and purpose, and is protected by
law.
> If you are not the intended recipient, please contact sender
immediately
> by reply e-mail and destroy all copies.  You are hereby notified that
any
> disclosure, copying, or distribution of this message, or the taking of
any
> action based on it, is strictly prohibited.
> TIAA-CREF
> **************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to