mybatis缓存

xiaoxiao2021-02-28  18

当使用同一个sqlSession条用相同的sql语句时,mybatis默认使用缓存中的sql语句; 默认select使用缓存,insert delete update不使用缓存 <!-- 1,size:表示缓存cache中能容纳的最大元素数。默认是1024; 2,flushInterval:定义缓存刷新周期,以毫秒计; 3,eviction:定义缓存的移除机制;默认是LRU(least recently userd,最近最少使用),还有FIFO(first in first out,先进先出) 4,readOnly:默认值是false,假如是true的话,缓存只能读。 --> <cache size="1024" flushInterval="60000" eviction="LRU" readOnly="false"/> 此配置必须放在<mapper namespace="com.czp.mappers.StudentMapper"> 下方
转载请注明原文地址: https://www.6miu.com/read-1600149.html

最新回复(0)