Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cache in Servlet

 
rex tony
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In our Web application,how can we use in Cache concepts,Any one can give the example?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are third party solutions available in the market, and few are open source too. Just search "cache solution java".

YOu can implement something of your own. For example if have a large dataset and you know the data changes less frequently you can create a flag column the table and which would tell you, that we need to refresh the cache. That column would get updated using database triggers. Is it making any sense to you. Or I need to elaborate it a little more.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also decide to gather some data into memory from the database and update this data after some time depending on the change rate of the data.

Popup values and options to choose from are mostly only configured once and doesn't need to gathered from the database each time. Also you could update some lists every hour when the user requests for a new list.

I gain a lot of performance improvement by implementing this.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Checkout these opensource cache solutions
OsCache
Opensource cache solutions
EhCache
[ January 17, 2008: Message edited by: sudhir nim ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Remko Strating:
you could update some lists every hour when the user requests for a new list.


Why go arbitrarily, when we can do it otherwise, say by using a flag in a table which tells you that, there is a need to update your cache.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic