Hibernate:是否有第三级缓存? [英] Hibernate : is there a third level of cache?
问题描述
在求职面试中,招聘人员问我休眠时有多少缓存级别?
During a job interview, a recruiter asked me about "how many cache levels are there in hibernate ?"
所以我描述了1级和2级。
So I described the level 1 and 2.
他说正确但是还有一个第三级缓存,例如缓存某些表的结果,这些表不会经常变化,如CURRENCY或COUNTRY并重新加载这些表格每个12/24 /你想要什么时间小时。
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 ?
更新:你认为他只是谈论query.setCacheable(true)描述这里? mrbool.com/how-to-use-hibernate-query-cache/33439。但是我在哪里可以定义缓存查询结果的时间长度?我想它永远不会缓存。如果就是这样,我将在如何用hibernate定义setCacheable的持续时间中重命名主题。
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.
推荐答案
有一个<在hibernate中强>查询缓存,但我不确定它是否可以被称为第三级缓存。我还没有听说过这样的名字。无论如何,查询缓存适用于不改变的数据经常。
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.
其文档可在以下网址找到: http://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/Hibernate_User_Guide.html#caching-query
Its documentation can be found at: http://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/Hibernate_User_Guide.html#caching-query
这篇关于Hibernate:是否有第三级缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!