mybatis_03:缓存

local cache

http://www.mybatis.org/mybatis-3/java-api.html

Mybatis uses two caches: a local cache and a second level cache

local cache

each time a new session is created
Mybatis creates a local cache and attaches it to the session.

所以同一session内的相同请求会走缓存。

当执行 update, commit, rollback,and close,the local cache 会被清除,

当设置全局localCacheScope=STATEMENT,彻底的没有缓存了。

默认 localCacheScope=SESSION,表示可以在单个session内走缓存。

全局settings

localCacheScope:
local cache

local cache .png

SESSION: 作用域在session级别

STATEMENT: 作用域在 preparedStatement级别

a second level cache
不要开启mybatis的二级缓存,
避免脏数据。

ORM: Object Relational Mapper

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容