Mybatis学习笔记(七)二级缓存

一、自带二级缓存

步骤:
1.在总配置文件中配置启用二级缓存
2.在需要进行二级缓存的mapper.xml中配置
3.测试
1.mybatis.xml
在这里插入图片描述
2.mapper.xml
在这里插入图片描述
3.test.java
在这里插入图片描述

4.console
在这里插入图片描述

二、使用第三方缓存(ehcache)

	步骤:
		1.导入ehcache依赖
		2.配置ehcache.xml
		3.在总配置文件中配置启用二级缓存
		4.在需要进行二级缓存的mapper.xml中配置
		5.测试

1.pom.xml
在这里插入图片描述
2.ehcache.xml
在这里插入图片描述
3.mybatis.xml
在这里插入图片描述
4.mapper.xml
在这里插入图片描述
5.测试同上

猜你喜欢

转载自blog.csdn.net/qq_43701801/article/details/89054514
今日推荐