update 关闭默认二级缓存 推荐使用 spring-cache 注解手动缓存

This commit is contained in:
疯狂的狮子li 2021-07-04 02:21:04 +08:00
parent c26073afeb
commit de194880ae
3 changed files with 4 additions and 3 deletions

View File

@ -158,7 +158,7 @@ mybatis-plus:
# STATEMENT 关闭一级缓存 # STATEMENT 关闭一级缓存
localCacheScope: SESSION localCacheScope: SESSION
# 开启Mybatis二级缓存默认为 true # 开启Mybatis二级缓存默认为 true
cacheEnabled: true cacheEnabled: false
# 更详细的日志输出 会有性能损耗 # 更详细的日志输出 会有性能损耗
# logImpl: org.apache.ibatis.logging.stdout.StdOutImpl # logImpl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config: global-config:

View File

@ -15,6 +15,9 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
/** /**
* mybatis-redis 二级缓存 * mybatis-redis 二级缓存
* *
* 使用方法 配置文件开启 mybatis-plus 二级缓存
* XxxMapper.java 类上添加注解 @CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
*
* @author Lion Li * @author Lion Li
*/ */
@Slf4j @Slf4j

View File

@ -11,8 +11,6 @@ import org.apache.ibatis.annotations.CacheNamespace;
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> { public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> {
} }