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;}

ps 图灵课堂老师从近一百套最新一线互联网公司面试题中精选而出,涵盖Java架构面试 所有技术栈,包括JVM,Mysql,并发,Spring,Redis,MQ,Zookeeper,Netty, Dubbo,Spring Boot,Spring Cloud,数据结构与算法,设计模式等相关技术领域的大 厂面试题及详解。 详情咨询客服获取全套面经试题。

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

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

标签: