Hibernate : is there a third level of cache?

2019-02-20 08:46发布

During a job interview, a recruiter asked me about "how many cache levels are there in hibernate ?"

So I described the level 1 and 2.

He said correct but there is also a third level cache, for example cache the result of some table that doesn't change often like "CURRENCY" or "COUNTRY" and reload these tables each "12/24/ What time you want" hours.

I search about that, but I found nothing. So is there really a third level of cache or is it just some kind of features and if yes what's the name of this feature and how can I use it ?

UPDATE : You think he just talk about query.setCacheable(true) describe here ? mrbool.com/how-to-use-hibernate-query-cache/33439. But where can I define how long I put in cache the result of the query ? I suppose it doesn't cache for ever. If it's just that, i will rename the subject in "How define a duration for setCacheable with hibernate.

1条回答
时光不老,我们不散
2楼-- · 2019-02-20 09:22

There is a query cache in hibernate, but I am not sure if it can be called "third level" cache. I haven't heard such a name. Anyway, the query cache would be applicable for data which does not change often.

Its documentation can be found at: http://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/Hibernate_User_Guide.html#caching-query

查看更多
登录 后发表回答