一级缓存(SqlSession对象的缓存),不用操作
二级缓存的开启(SqlSessionFactory对象的缓存):
- 主配置文件SqlMapConfig.xml中配置,默认也是true,可以不用写
<settings> <!--开启缓存--> <setting name="cacheEnabled" value="true"/> </settings>
dao接口使用注解@CacheNamespace(blocking = true)@CacheNamespace(blocking = true) public interface AccountDao { }
mybatis注解开发-缓存的开启
猜你喜欢
转载自blog.csdn.net/weixin_38503726/article/details/86507097
今日推荐
周排行