You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Stuart Maclean <st...@apl.washington.edu> on 2009/12/24 19:39:25 UTC

disk backed cache comments

It is apparent that the disk backed cache in JCS uses  
java.io.Serializable as its byte stream format.  As far as i can tell,  
this means that any cache element which MAY be sent out to disk must  
implement Serializable.  There is no way to put an arbitrary object in  
memory cache and provide a 'toSerializable' transformer to be used if  
and when the object is written to disk.

For anyone using JCS for Image caching (I have a Swing map system with  
Image tiles, each 256 pixels square, like GoogleMaps), you'll know  
that Image is not serializable, so some codec must be used between  
your Image objects and a JCS cache configured for disk caching.  I was  
using PixelGrabber and MemoryImageSource as my codec.  The cache  
element size is then 256 *256 * 4, where 4 is the bytes per pixel I am  
using (RGBA).

Much better for size and seemingly fast enough in time is to use  
ImageIO read/write to PNG format, essentially producing a PNG 'file'  
as the JCS element type.  For my map tiles I get huge space benefits  
over raw pixGrab.

Hope this helps anyone using JCS for Images.

Great product Aaron BTW.

Stuart


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org