首页 > 图灵资讯 > 技术篇>正文

Mybatis中二级缓冲的设置步骤

2023-05-10 17:21:54

Mybatis中二级缓冲设置步骤

在mybatiss中打开全局配置文件.在xml文件中设置,默认为truee <settings> <setting name="cacheEnabled" value="false"/> </settings>

2.添加到mapper文件中:

<cache>或<cached-ref>

3.在select语句中配置usecache=true,默认为true

<select id="selectPage" resultMap="usersMap" useCache="true">

4.实体类需要实现Serializable的序列接口

public class User implements Serializable { private int id; private String userName; private String password;}

上一篇 【MQ】kafka(三)——如何保证消息不丢失?如何解决?
下一篇 【Linux】crontab——定时执行任务,表达式编写

文章素材均来源于网络,如有侵权,请联系管理员删除。