Caching benefits and pitfalls

In general, the caching mechanism is designed to improve the performance of the application. This is particularly true for data that doesn't change often. Reference data is a perfect example. Another example is articles posted on a discussion forum. Of course, if this data ever changes, you would have to implement the capability to invalidate and refresh the cache. It is a general belief that your application should perform reasonably well without caching enabled. However, there are many things you could do to improve the performance and responsiveness of your application, and caching is one of those things.

However, with this added feature come pitfalls. Caching persisted data is not a good idea if the data can be ...

Get Mastering Hibernate now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.