-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

> This is similar to what I am doing. I have a Hashtable called cache that
> I stuff pages into, based on the request.getPathInfo(). I have a finite
> number of pages to put in, so memory constraints don't cause a problem
> (yet).
> My doGet() method starts of by checking the cache for the page, and
> builds it if it isn't in the cache. At this point it is simple, but I'd
> surely be interested in discussing the issue with others who are doing
> or considering it. Thanks.
> -mdf

We did it essentially the same way. One thing you might want to do is
encapsulate the process with an object that defines things like the amount
of time to cache the data, etc. So, you have an object that has as its
private methods, things like "expire_time", "data", etc...then you put that
object into the Hashtable...you can then have a background thread that
expires the object from the hashtable if it is old. You can also implement a
size() attribute so that you can keep a running total of the amount of data
in the hashtable so that you don't run into memory constraints...

of course there is a million ways to skin this cat...but that is a couple of
ideas to get you all started...

-jon


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to