I'm having one application which fires the same query again and again on every page request coming from the browser. so I want to cache that query result from first time request triggered ,which results in an arraylist, so that on every request coming from browser ,It should not fire the same query again and again.
can you please share your thoughts or inputs ?
Edit:
Frameworks : I'm using ibatis framework for database query and struts with displaytag for UI
Here is the snippet of code :
if (req.getParameter("d-2464500-p") == null) {
UserService userService = UserServiceFactory.getUserService();
long startTime1 = System.nanoTime();
log.info("start time is :" + startTime1);
userList = userService.getUserList();
} else {
// I want to use the same queried userList for the other pages
// so that i should not go and fire the query
}