mybatis的二级缓存
mybatis的二级缓存:
1.实体类实现序列化接口.
implements Serializable
2.在mapper.xml中开启mybatis自带的二级缓存(需要用到那个实体的缓存就开启)
仅仅作用于该mapper中
<!--开启mtbatis自带的二级缓存-->
<cache type="org.apache.ibatis.cache.impl.PerpetualCache"/>
3.在sqlMapConfig.xml中开启mybatis的二级缓存
<!--开启mybatis的二级缓存-->
<setting name="cacheEnabled" value="true"/>


浙公网安备 33010602011771号