admin管理员组

文章数量:1208155

We are currently using Hibernate Second-Level Cache (READ_WRITE) to cache our database queries. However, we have the problem that asynchronous updates of the database (by another application of ours) do not invalidate the Hibernate second-level cache. Currently we invalidate the cache "manually" via an API that calls entitymanager.getEntityManagerFactory().getCache().evictAll().

I know there are some older posts (>8 years) dealing with this topic, but I would be reluctant to integrate the answers suggested there (e.g. with UDFs) into our applications.

So are there any other (simple/easy) ways to automatically invalidate the Hibernate second-level cache when another application changes the contents of the database?

Thanks for your ideas.

本文标签: spring bootHibernate SecondLevel Cache Inconsistent after Async UpdateStack Overflow