缓存回顾
- 什么是缓存?文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
MyBatis 对缓存的支持
MyBatis 也提供了对缓存的支持,分为 一级缓存
和 二级缓存
。可以用下面的图来理解:文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
-
什么是 MyBatis 的一级缓存?文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
- 一级缓存是 SqlSession 级别的缓存。在操作数据库时,需要构造 SqlSession 对象,在对象中有一个 HashMap 的数据结构用于存储缓存数据。不同的 SqlSession 之间缓存的数据区域(HashMap)是不同的。
-
什么是 MyBatis 的二级缓存?文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
- 二级缓存是 Mapper 级别的缓存。多个 SqlSession 操作同一个 Mapper 的 sql 语句,多个 SqlSession 可以共用二级缓存,二级缓存是跨 SqlSession 的。
文章更新历史文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
2024/05/14 同步文章到其他平台文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
2024/05/14 新增闪卡标记文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
2022-09-06 feat:初稿 文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
本文介绍了缓存的概念,并着重介绍了MyBatis对缓存的支持,包括一级缓存和二级缓存。一级缓存是SqlSession级别的,而二级缓存是Mapper级别的,能够提高系统的响应速度。文章源自浅海拾贝-https://blog.terwergreen.com/the-concept-of-mybatis-cache-nfdfh.html
- 扫码加我微信
- 验证消息请输入:来自你的博客
-
- 我的微信公众号
- 微信扫一扫与我交流吧
-
评论