🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1、二级缓存:写sql方式,扩展mybatis的二级缓存org.walkframework.batis.cache.L2Cache,其他与mybatis二级缓存使用方法一致 ~~~ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="OptionsSQL"> <!-- 缓存 --> <cache type="org.walkframework.batis.cache.L2Cache"> <property name="cacheSeconds" value="7200"/> </cache> <select id="queryXXXList" resultType="org.walkframework.data.util.DataMap"> SELECT T.CODE, T.NAME FROM TD_S_XXX T ORDER BY T.CODE </select> </mapper> ~~~ 2、二级缓存:不写sql方式,指定缓存时间,单位秒 ~~~ TfNList cond = new TfNList(); cond.setListId("NOMC14027909").asCondition(); int cacheSeconds = 7200; List<TfNList> list = dao.selectList(cond, cacheSeconds); ~~~