Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How do you achieve caching in Java based application?  RSS feed

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you develop a Java based web application, how do you achieve caching nowadays?
I've studied Caching in Hibernate, there were 1st level cache, 2nd level cache and Query level cache.  Is that all about caching?
I want to know about the real time applications, is Caching achieved by using third party software?
Is caching part separate from the application code, like a load balancer?
Or it is something that you create a separate class where you use Collection to save the data?

Thanks in advance.
 
Saloon Keeper
Posts: 5496
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caching can take many forms. You could create your own cache using data structures in your code (maybe using collections, maybe using other classes), or you could use a 3rd party library (like JBoss Cache or EhCache), or you could use an external caching server like Memcache or Redis.
 
Arun Singh Raaj
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
May I know which one is the most preferable way among you've given, to create cache nowadays?
And I want to know where does the cache reside, is it stored into the db?
 
Tim Moores
Saloon Keeper
Posts: 5496
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

May I know which one is the most preferable way among you've given, to create cache nowadays?


That can't be answered in general, it depends on the circumstances.

And I want to know where does the cache reside, is it stored into the db?


In memory. In a way, caches ARE databases, but their contents are not persisted. If the applications powers down, whatever was in the cache is lost - so the app needs to take care of filling the cache at startup time, or during the lifetime of the app.
 
Saloon Keeper
Posts: 10249
216
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember, caching is one of the hardest issues in computer science.

The other three are naming things and off-by-one errors.
 
I child proofed my house but they still get in. Distract them with this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!