mybatis 缓存

 mybatis
缓存

一级缓存,sqlsession级别的
二级缓存,namespace级别的
settings里面开启二级缓存
mapper里面设置cache
POJO要实现序列化接口
查出的数据先在一级缓存中,会话结束才转移到二级缓存

enableCache
useCache
flushCache
sqlSession.clearCache
localCacheScope

ehcache,在cache的标签内引入type属性全类名
cache-ref,在namespace引用其他的缓存配置 

猜你喜欢

转载自blog.csdn.net/singgel/article/details/80054187