jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Smuts, Aaron" <Aaron.Sm...@travelocity.com>
Subject RE: How to implement write-thru caching with JCS?
Date Mon, 25 Jul 2005 14:47:51 GMT
It's not perfectly clear to me what you're asking.  In any case, it
looks like you have too much code in your jsp pages, which in my
experience leads to big problems.  Why don't you create a common data
access layer and control the caching there.  When you add records you
can invalidate related cache entries, etc.  If you follow an MVC pattern
then you would probably already have such a layer.  Given your current
code, can't you just clean up whatever lists jsp1 uses in jsp2?

Aaron


> -----Original Message-----
> From: Prasad xyz [mailto:pvjava@gmail.com]
> Sent: Sunday, July 24, 2005 10:08 PM
> To: jcs-users@jakarta.apache.org
> Subject: How to implement write-thru caching with JCS?
> 
> Hi folks,
> 
> I have a simple jsp which displays a really huge table (10k+ rows),
> the jsp just invokes a bean which does all the query execution and
> populates & returns an arraylist based on the resultset object:
> 
> //this is within jsp1
> <jsp:useBean id="display" class="reports.Database" />
> 
> <%
> //this method executes the query and
> populates & returns an arraylist object
> ArrayList result = display.showTable();
> %>
> 
> //loop thru the arraylist to render the table
> 
> <TABLE BORDER=2>
> <%
> for(int i=0; i<result.size(); i++) {
> 	out.println(((StringBuffer)result.get(i)).toString());
> }
> %>
> </TABLE>
> 
> I am planning to use JCS to cache the arraylist object so that I avoid
> issuing a fresh query everytime a user hits jsp1.
> 
> I also have another jsp which writes to the same table, so the
underlying
> table is modified every time a user inputs data using the other jsp
(jsp2)
> 
> My question is - how would I do write-thru caching in this scenario?
> if a user hits jsp1 and the arraylist object is cached, then user goes
> to jsp2 and updates some data, I want the cache to realise that the
> underlying table got modified and dynamically refresh the cached
> arraylist object by calling display.showTable(), so now when the
> user goes back to jsp1 then the updated data is instantly served
> from the cache, is it possible to do something like this in JCS?
> 
> I would appreciate any help on this, thanks in advance!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org

---------------------------------------------------------------------
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