简体   繁体   English

了解休眠一级缓存

[英]understanding hibernate first level cache

session.open
insertIntoTODB()
getList()
session.close

session.open()
getList();
sesson.close()

1st leve cache is only bounded in session open and close and for 2nd subsequent session open, getList() will get from DB instead of cache? 第一个级别的缓存仅在会话打开和关闭中受限制,对于第二个后续会话的打开,getList()将从数据库而不是从缓存中获取吗?

Yes. 是。 The 1st level cache is for the session only. 1级缓存仅用于会话。 The second getList() call will go to the database. 第二个getList()调用将转到数据库。

EDIT: The second getList() call will go to the database, in the absence of the second level cache, as well noted by mR_fr0g in his answer. 编辑:第二次getList()调用将在没有第二级缓存的情况下进入数据库,正如mR_fr0g在他的回答中指出的那样。

The first level cache is session scope. 一级缓存是会话范围。 The second getList() will go to the database only in the absence of a second level cache . 仅当没有二级缓存时 ,第二个getList()才会进入数据库。 Second level caches are session factory scoped. 二级缓存是会话工厂范围的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM