jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fox1964 <hucho...@yahoo.com>
Subject How to Cache A Physical File
Date Wed, 07 Oct 2009 03:16:45 GMT

I have a large physical file downloaded to my server.   I'd like to cache the
file so that my program can read faster.  I've configured JCS properly.   I
can see the "mycache.key" and "mycache.data" files are updated every time I
use a string for both a key/value pair.    But how can I put a physical file
into cache?   Right now, I use an "FileInputStream" object to read the file,
and put into the cache.

FileInputStream input = new FileInputStream(file);
           cache.put(input);

This seems to go thru without prompting any error message.   But when I
tried to retrieve it, I got a message "java.lang.NullPointerException" when 
           cache.get(key);

I can see the mycache.key file updated, but can NOT see any updates in
mycache.data file by looking at the timestamp.

Any guru can show me what I may do wrong?   Or do you have any sample code
to do this?   Thanks a lot in advance.


-- 
View this message in context: http://www.nabble.com/How-to-Cache-A-Physical-File-tp25779933p25779933.html
Sent from the JCS - Users mailing list archive at Nabble.com.


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


Mime
View raw message