深入理解 MyBatis - 缓存
特别说明
当前文章内容迁移中,如有问题,请提交 issues 谢谢 ~~
MyBaits 一级缓存
包名+函数名 进行 map 缓存,一旦设计到写入操作,比如 update 就会将缓存全部情况。
由于 MyBatis 无法确定是哪个缓存,所以就会将所有的操作置空。
一级缓存中,sqlSession 会有自己的缓存,不同的 sqlSession 不会共享缓存。
可以手动执行缓存清除
sqlSession.clearCache()
当前文章内容迁移中,如有问题,请提交 issues 谢谢 ~~
MyBaits 一级缓存
包名+函数名 进行 map 缓存,一旦设计到写入操作,比如 update 就会将缓存全部情况。
由于 MyBatis 无法确定是哪个缓存,所以就会将所有的操作置空。
一级缓存中,sqlSession 会有自己的缓存,不同的 sqlSession 不会共享缓存。
可以手动执行缓存清除
sqlSession.clearCache()