Costas Malamas wrote:
> I am trying to take some load off my DB server by caching
> query results
> within a Servlet instance (instead of a session).  Is it as simple as
> assigning objects to self.myResults?  What's the life-span of
> these objects
> (I am guessing the lifetime of the servlet, right?) and is
> there a way to
> increase/decrease that life-span from the configuration?
> 

A servlet instance lives "forever" and is not destroyed until the appserver
is stopped.  Also, there will are multiple servlet instances in a pool and
they will be used to handle requests pretty much at random.  It's not really
a good idea to cache information in a servlet across requests.  It's fine to
store stuff in the servlet _during_ a single request.

A cache is better off as a module variable or a class variable so it can be
shared across servlet instances.  I have a cache implementation that I use
that I can upload into the Webware Sandbox.  I'll send another message when
I've done that.

- Geoff


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to