This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Transfer Learning for Natural Language Processing (MEAP) and have Paul Azunre on-line!
See this thread for details.
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

How do you achieve caching in Java based application?

 
Ranch Hand
Posts: 240
2
  • 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: 6379
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • 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: 240
2
  • 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: 6379
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • 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: 11882
253
  • 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.
 
Our first order of business must be this 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