[Opensymphony-oscache] Cache works but doesn't recognize changes in underlying data

John <[email protected]> Mon, 29 Aug 2005 13:29:44 CDT
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <30474084.1125340214558.JavaMail.os-j2ee@opensymphony01.contegix.com>
Ok, I answered my own question. 
Everything started working as I wanted when I put the following at the top of the page (tile)
<%
response.setHeader("Expires", "0");
// Date in the past
response.setHeader("Cache-Control" ,"no-cache, must-revalidate");
// HTTP/1.1
response.setHeader("Pragma", "no-cache");
// HTTP/1.0
%>
The reason is that the entire page was getting cached by Tomcat. OSCACHE is meant to cache portions of the JSP page so what that means is you want the page to render every time EXCEPT for the cached portion or more specifically, the content within the <cache:cache..> tags. When I added the code above to stop the overall page from being cached by tomcat the portion of code that built the key and executed the cache tag was executed EVERY TIME as I wanted. However, the oscache content remains cached. If the data changes, it is recognized through the key. So it's working correctly.
So, in the end, I think that tomcat was interferring with checking the cache.
- John

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