intermediateCaching — Second-Level Cache, Query Cache & Redis

Why is an in-process cache like EHCache or Caffeine risky in a multi-instance deployment?

Each application instance holds its own separate copy of the cache — an update on one instance doesn't invalidate another instance's stale cached copy, since there's no shared state between them. A distributed cache like Redis solves this by giving every instance a single shared view.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why can Hibernate's query cache be less effective than expected on a frequently-written table?← Back to all Spring Data JPA & Hibernate Mastery questions