Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

QuickCache for PHP whats for Java

 
Ranch Hand
Posts: 138
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a java web application. My application uses Struts2. My application generates the results of games (each state page have around 10 games and the results are published twice daily for 7 games and two are weekly).

Now I dont want to generate the same html (from JSP everytime) instead I want to Cache the generated HTML page (like PHP Caching) and only generate the new page when ever there is a change in the states data..

Is there any tool like QuickCache for PHP available for Java ?

Or Do I need to program it manually, If yes, can you suggest me the best method to implement this.

Thanks in advance,
Bala.
 
Saloon Keeper
Posts: 6377
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not an expert on Struts, but I would imagine caching some parts of the HTML not being worth the effort. Leave Struts and JSP to cache what they can anyway, and don't worry about it. The only thing for the app to do is to cache the relevant data in memory - not having to obtains and compute the stats, presumably from a DB, is likely to have a bigger effect than trying to avoid some HTML generation.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bala Tilak wrote:Hi All,

I have a java web application. My application uses Struts2. My application generates the results of games (each state page have around 10 games and the results are published twice daily for 7 games and two are weekly).

Now I dont want to generate the same html (from JSP everytime) instead I want to Cache the generated HTML page (like PHP Caching) and only generate the new page when ever there is a change in the states data..

Is there any tool like QuickCache for PHP available for Java ?

Or Do I need to program it manually, If yes, can you suggest me the best method to implement this.

Thanks in advance,
Bala.



EHCache provides support for memory and disk stores. EHCache provides LRU (Least Recently Used), LFU (Least Frequently Used), FIFO (First In First Out) algorithms out-of-the box algorithms for object eviction from memory. EHCache offers support for distributed caching
 
Tim Moores
Saloon Keeper
Posts: 6377
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EhCache does nothing for HTML (fragment) caching. Caching arbitrary data is not the issue.
 
Bala Tilak
Ranch Hand
Posts: 138
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Yes , as per my research on Internet also , I think, caching frequently accessed data (which dont change often ) from DB is a better choice. So we can avoid DB access for this data.

Now the question is , lets say I have a set of records, the lottery results of a state which change once in a day. I cached these results in Java (as there are 1000s of page requests for the same results on my website.). Is there any Pattern/algorithm to manage this cached data to automatically refresh when the corresponding records updated in DB ?. I am maintaining last updated column in DB for each of this lottery entry. Either programatically or using existing Cache framework in Java.


Regards,
Bala.
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic