Hibernate使用的默认缓存? [英] Default cache used by Hibernate?
问题描述
Hibernate使用的默认缓存的名称是什么?
What is the name of the default cache used by Hibernate? Is there a default cache even, or do you have to add a cache provider in order to take advantage of a cache?
我以为是EHCache,但我认为这是默认缓存,还是必须添加缓存提供程序才能利用缓存?必须配置...默认情况下它不是那里 ...
I thought it was the EHCache but I think this has to be configured...it is not "there" by default...
推荐答案
Hibernate已经提供了一种称为持久上下文一级缓存。它位于 Session 范围内,默认情况下处于启用状态,无法将其打开
Hibernate already provides a caching mechanisms called 1st level cache by the persistent context . It is in the Session scoped , enabled by default and cannot be turned off.
诸如EHCache之类的缓存提供程序提供了另一种称为 2级缓存的缓存机制。它在 SessionFactory 范围内。默认情况下,没有启用第二级缓存,您必须对其进行配置。
The cache provider such as EHCache provides another caching mechanisms called 2nd level cache . It is in the SessionFactory scoped . No 2nd level cache is enable by default and you have to configure it .
请参见这有关如何在休眠模式下启用EHCache。
See this for how to enable EHCache in hibernate.
这篇关于Hibernate使用的默认缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!