关于mybatis里头的Executor

关于mybatis里面的Executor使用mybatis查寻数据,跟踪其执行流程最开始执行的语句public Executor newExecu

关于mybatis里面的Executor
使用mybatis查寻数据,跟踪其执行流程

最开始执行的语句

  public Executor newExecutor(Transaction transaction, ExecutorType executorType, boolean autoCommit) {    executorType = executorType == null ? defaultExecutorType : executorType;    executorType = executorType == null ? ExecutorType.SIMPLE : executorType;    Executor executor;    if (ExecutorType.BATCH == executorType) {      executor = new BatchExecutor(this, transaction);    } else if (ExecutorType.REUSE == executorType) {      executor = new ReuseExecutor(this, transaction);    } else {      executor = new SimpleExecutor(this, transaction);    }    if (cacheEnabled) {      executor = new CachingExecutor(executor, autoCommit);    }    executor = (Executor) interceptorChain.pluginAll(executor);    return executor;  }

CachingExecutor可以使mybatis先从缓存中提取数据,数据缓存中没有数据时才从数据库里面提取数据