[Opensymphony-oscache] How to implement write-thru caching with oscache?

pvcache <[email protected]> Sun, 24 Jul 2005 20:39:17 CDT
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <24830129.1122255620950.JavaMail.os-j2ee@opensymphony01.contegix.com>
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 oscache 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 oscache?

I would appreciate any help on this, thanks in advance!

---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=4658&messageID=11290#11290