update 关闭默认二级缓存 推荐使用 spring-cache 注解手动缓存
| | |
| | | # STATEMENT 关闭一级缓存 |
| | | localCacheScope: SESSION |
| | | # 开启Mybatis二级缓存,默认为 true |
| | | cacheEnabled: true |
| | | cacheEnabled: false |
| | | # 更详细的日志输出 会有性能损耗 |
| | | # logImpl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | global-config: |
| | |
| | | /** |
| | | * mybatis-redis 二级缓存 |
| | | * |
| | | * 使用方法 配置文件开启 mybatis-plus 二级缓存 |
| | | * 在 XxxMapper.java 类上添加注解 @CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @Slf4j |
| | |
| | | * @author ${author} |
| | | * @date ${datetime} |
| | | */ |
| | | // 如使需切换数据源 请勿使用缓存 会造成数据不一致现象 |
| | | @CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) |
| | | public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> { |
| | | |
| | | } |