Reputation: 4322
I have a 'search' page that let the user select some search by options. These option include a number of dropdowns filled by the database. These dropdowns might change but will rarely (once a month at most).
Right now our page hits the database everytime it loads the page to fill these dropdowns, and page load is roughly 3-4 seconds. I want it to cache the page server side and only have the jsp be processed every hour or so. Any request that comes in should get the most recent output of the processed jsp, but not cause the server to reprocess it. That is, I want page refresh to always be sepreate from the get method so now user will never have to wait more the .5 sec to get the page.
Is it possible to server side cache a jsp page like you can in asp ( Is it possible to cache an asp page on the server side? ) to solve this problem? What approaches are generally used to solve this problem? I can think of solutions, but I dont want to reinvent the wheel if common best practices have already been developed, which I know they must have been.
thanks!
Upvotes: 1
Views: 1070
Reputation: 48753
What about JSTL c:set
? Here example of menu caching:
<c:if test="${empty JSPCACHE_menu}">
<c:set var="JSPCACHE_menu" scope="session">
<ul id="user-menu">...</ul>
</c:set>
</c:if>
${JSPCACHE_menu}
Upvotes: 1
Reputation: 6273
if you are using spring then i think spring cache abstraction is for also rescue. i have used this in same kind of scenario where i am caching output of controller methods and some service methods. Spring cache provide good use of cache as cross cutting concern.
Upvotes: 0