Caches are usually just some kind of collection as a static variable on a class with static methods to get & put stuff. So it's that easy to make something available to all users ... in one JVM.
The cache is a gamble that it's worth using up memory to give faster access to frequently requested data than you'd get from a database or file system or some other source. For something like your application, you'd want the data to also be in a database or file system for long term storage and you should update or clear the cache any time you update those external data stores. Now you're also gambling that the complexity of keeping the cache in sync is worth it.
Finally, if you have multiple JVMs in a cluster you have to keep them all in sync. An in-memory cache might be a very complex thing if your data changes often, or a very simple thing if your data never changes.
Any of that sound like you can use it?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Any resource you suggest to read more about caching?
I am planning to implement the cache in the middle tire using VLH and DAO so servlet filters are not an option for me.
Take a look at the Servlet filters. You can implement caching by using them.
Joined: Jan 29, 2003
I don't know any resources better than Google for "java cache" or for more complex fun "java distributed cache". I make sure in my systems to have a management tool to clear caches in a running system. I can change things in the database and clear cache so the app loads the new data.