aspose file tools*
The moose likes Servlets and the fly likes Cache in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cache in Servlet" Watch "Cache in Servlet" New topic
Author

Cache in Servlet

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
In our Web application,how can we use in Cache concepts,Any one can give the example?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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

Joined: Dec 28, 2006
Posts: 893
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.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Checkout these opensource cache solutions
OsCache
Opensource cache solutions
EhCache
[ January 17, 2008: Message edited by: sudhir nim ]

[Servlet tutorial] [Servlet 3.0 Cook Book]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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.
 
jQuery in Action, 2nd edition
 
subject: Cache in Servlet