Java – hibernate query cache is automatically refreshed when external updates are made?

I am creating a service with read - only access to the database In Hibernate, I have a query cache and L2 cache enabled (read_only mode) to speed up the service, because the accessed tables rarely change

My question is, if someone enters the DB and manually changes the table (i.e. outside hibernate), does the cache automatically recognize that it needs to be cleared? Is there a time limit for caching?

Solution

No, the cache does not scan the database so that you can magically update yourself when the underlying data changes Changes that will not be made through the L2 cache will not appear in it How long to wait depends on your provider and default settings It looks like the default ehcache XML is 2 minutes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>