This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ff7f29e414 Merge ShardingCacheRule into ShardingRule (#25520)
5ff7f29e414 is described below

commit 5ff7f29e414e09b25b3e39b476c9df86fe182473
Author: 吴伟杰 <[email protected]>
AuthorDate: Tue May 9 11:13:51 2023 +0800

    Merge ShardingCacheRule into ShardingRule (#25520)
    
    * Merge sharding cache plugin into sharding modules
    
    * Refactor CachedShardingSQLRouter
    
    * Fix checkstyle in CachedShardingSQLRouter
    
    * Complete ShardingRuleConfigurationYamlIT
    
    * Update documents for sharding cache
    
    * Complete YamlShardingRuleConfigurationSwapper
    
    * Remove usage of shardingsphere-sharding-cache
    
    * Update documents about optional plugins
---
 .../optional-plugins/_index.cn.md                  |   1 -
 .../optional-plugins/_index.en.md                  |   1 -
 .../yaml-config/rules/sharding-cache.cn.md         |   6 +-
 .../yaml-config/rules/sharding-cache.en.md         |   6 +-
 .../optional-plugins/_index.cn.md                  |   1 -
 .../optional-plugins/_index.en.md                  |   1 -
 .../api/config/ShardingRuleConfiguration.java      |   3 +
 .../config/cache/ShardingCacheConfiguration.java}  |  10 +-
 .../cache/ShardingCacheOptionsConfiguration.java}  |   4 +-
 .../sharding/cache/ShardingCache.java}             |  21 +--
 .../checker/ShardingRouteCacheableCheckResult.java |   0
 .../checker/ShardingRouteCacheableChecker.java     |  16 +-
 .../CacheableShardingAlgorithmChecker.java         |   0
 .../CacheableShardingAlgorithmClassProvider.java   |   0
 ...tInCacheableShardingAlgorithmClassProvider.java |   0
 .../cache/route/CachedShardingSQLRouter.java       |  82 +++++-----
 .../cache/route/cache/ShardingRouteCache.java      |   6 +-
 .../cache/route/cache/ShardingRouteCacheKey.java   |   0
 .../cache/route/cache/ShardingRouteCacheValue.java |   0
 .../sharding/route/engine/ShardingSQLRouter.java   |  19 ++-
 .../shardingsphere/sharding/rule/ShardingRule.java |  13 ++
 .../yaml/config/YamlShardingRuleConfiguration.java |   3 +
 .../cache/YamlShardingCacheConfiguration.java}     |  12 +-
 .../YamlShardingCacheOptionsConfiguration.java     |   2 +-
 .../YamlShardingRuleConfigurationSwapper.java      |   9 ++
 .../YamlShardingCacheConfigurationSwapper.java     |  43 +++++
 ...mlShardingCacheOptionsConfigurationSwapper.java |  14 +-
 ...gorithm.CacheableShardingAlgorithmClassProvider |   0
 .../checker/ShardingRouteCacheableCheckerTest.java |  22 +--
 .../cache/route/CachedShardingSQLRouterTest.java   | 142 +++++++++++++++++
 .../cache/route/cache/ShardingRouteCacheTest.java  |   4 +-
 .../yaml/ShardingRuleConfigurationYamlIT.java      |  12 ++
 ...YamlShardingCacheConfigurationSwapperTest.java} |  38 ++---
 ...ardingCacheOptionsConfigurationSwapperTest.java |  10 +-
 .../src/test/resources/yaml/sharding-rule.yaml     |   7 +
 features/sharding/plugin/cache/pom.xml             |  50 ------
 .../rule/builder/ShardingCacheRuleBuilder.java     |  58 -------
 .../yaml/YamlShardingCacheRuleConfiguration.java   |  41 -----
 .../YamlShardingCacheRuleConfigurationSwapper.java |  59 -------
 ...org.apache.shardingsphere.infra.route.SQLRouter |  18 ---
 ...infra.rule.builder.database.DatabaseRuleBuilder |  18 ---
 ...onfig.swapper.rule.YamlRuleConfigurationSwapper |  18 ---
 .../cache/route/CachedShardingSQLRouterTest.java   | 173 ---------------------
 .../rule/builder/ShardingCacheRuleBuilderTest.java |  66 --------
 features/sharding/plugin/pom.xml                   |   1 -
 jdbc/core/pom.xml                                  |   5 -
 proxy/bootstrap/pom.xml                            |   5 -
 47 files changed, 369 insertions(+), 651 deletions(-)

diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md
index 703c1d6dab7..9c5f6398d37 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md
@@ -23,7 +23,6 @@ ShardingSphere 默认情况下仅包含核心 SPI 的实现,在 Git Source 存
 - 
`org.apache.shardingsphere:shardingsphere-postgresql-dialect-exception`,数据库网关的 
PostgreSQL 实现
 - `org.apache.shardingsphere:shardingsphere-readwrite-splitting-core`,读写分离核心
 - `org.apache.shardingsphere:shardingsphere-shadow-core`,影子库核心
-- `org.apache.shardingsphere:shardingsphere-sharding-cache`,分片缓存,参考未关闭的 
https://github.com/apache/shardingsphere/issues/21223
 - `org.apache.shardingsphere:shardingsphere-sharding-core`,数据分片核心
 - `org.apache.shardingsphere:shardingsphere-single-core`,单表(所有的分片数据源中仅唯一存在的表)核心
 - `org.apache.shardingsphere:shardingsphere-sql-federation-core`,联邦查询执行器核心
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md
index 01bf4b7b1f2..e4779fc2912 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md
@@ -23,7 +23,6 @@ All the built-in plugins for ShardingSphere-JDBC are listed 
below in the form of
 - `org.apache.shardingsphere:shardingsphere-postgresql-dialect-exception`, 
PostgreSQL implementation of database
 - `org.apache.shardingsphere:shardingsphere-readwrite-splitting-core`, 
read-write splitting core
 - `org.apache.shardingsphere:shardingsphere-shadow-core`, shadow library core
-- `org.apache.shardingsphere:shardingsphere-sharding-cache`, sharding 
cache,refer to https://github.com/apache/shardingsphere/issues/21223
 - `org.apache.shardingsphere:shardingsphere-sharding-core`, data sharding core
 - `org.apache.shardingsphere:shardingsphere-single-core`, single-table (only 
the only table that exists in all sharded data sources) core
 - `org.apache.shardingsphere:shardingsphere-sql-federation-core`, federation 
query executor core
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.cn.md
index 34c61620283..f587c1c7093 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.cn.md
@@ -20,7 +20,11 @@ weight = 10
 
 ```yaml
 rules:
-  - !SHARDING_CACHE
+- !SHARDING
+  tables:
+  shardingAlgorithms:
+  # ...
+  shardingCache:    
     allowedMaxSqlLength: 512 # 允许缓存的 SQL 长度限制
     routeCache:
       initialCapacity: 65536 # 缓存初始容量
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.en.md
index a189a31ae29..92a5dd4a403 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding-cache.en.md
@@ -20,7 +20,11 @@ If the above conditions are not met, the execution delay of 
SQL may not be signi
 
 ```yaml
 rules:
-  - !SHARDING_CACHE
+- !SHARDING
+  tables:
+  shardingAlgorithms:
+  # ...
+  shardingCache:
     allowedMaxSqlLength: 512 # Allow cached SQL length limit
     routeCache:
       initialCapacity: 65536 # Initial capacity
diff --git 
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
 
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
index fdd993d79ba..c4f89977dec 100644
--- 
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
@@ -22,7 +22,6 @@ ShardingSphere 默认情况下仅包含核心 SPI 的实现,在 Git Source 存
 - `org.apache.shardingsphere:shardingsphere-proxy-frontend-postgresql`,用于 
ShardingSphere-Proxy 解析与适配访问数据库的协议的 PostgreSQL 实现
 - `org.apache.shardingsphere:shardingsphere-proxy-frontend-opengauss`,用于 
ShardingSphere-Proxy 解析与适配访问数据库的协议的 openGauss 实现
 - `org.apache.shardingsphere:shardingsphere-proxy-backend-core`, 
ShardingSphere Proxy 的后端核心模块
-- `org.apache.shardingsphere:shardingsphere-sharding-cache`, 分片缓存,参考未关闭的 
https://github.com/apache/shardingsphere/issues/21223
 - 
`org.apache.shardingsphere:shardingsphere-standalone-mode-core`,单机模式配置信息持久化定义核心
 
 对于核心的 
`org.apache.shardingsphere:shardingsphere-jdbc-core`,其内置插件参考[ShardingSphere-JDBC
 可选插件](/cn/user-manual/shardingsphere-jdbc/optional-plugins/)。
diff --git 
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
 
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
index 3870a310619..dd23b7f8d39 100644
--- 
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
@@ -22,7 +22,6 @@ All the built-in plugins for ShardingSphere-Proxy are listed 
below in the form o
 - `org.apache.shardingsphere:shardingsphere-proxy-frontend-postgresql`, a 
PostgreSQL implementation for ShardingSphere-Proxy to parse and adapt the 
protocol for accessing the database
 - `org.apache.shardingsphere:shardingsphere-proxy-frontend-opengauss`, an 
openGauss implementation for ShardingSphere-Proxy to parse and adapt the 
protocol for accessing the database
 - `org.apache.shardingsphere:shardingsphere-proxy-backend-core`, the backend 
core for ShardingSphere Proxy
-- `org.apache.shardingsphere:shardingsphere-sharding-cache`, sharding cache, 
refer to https://github.com/apache/shardingsphere/issues/21223
 - `org.apache.shardingsphere:shardingsphere-standalone-mode-core`, the 
persistence definition core of single-machine mode configuration information
 
 For the core `org.apache.shardingsphere:shardingsphere-jdbc-core`,Its built-in 
plugins reference[ShardingSphere-JDBC Optional 
Plugins](/en/user-manual/shardingsphere-jdbc/optional-plugins/).
diff --git 
a/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
index 6a792fe3b1b..cd927169045 100644
--- 
a/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
+++ 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
@@ -22,6 +22,7 @@ import lombok.Setter;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.config.rule.function.DistributedRuleConfiguration;
 import 
org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
@@ -64,4 +65,6 @@ public final class ShardingRuleConfiguration implements 
DatabaseRuleConfiguratio
     private Map<String, AlgorithmConfiguration> keyGenerators = new 
LinkedHashMap<>();
     
     private Map<String, AlgorithmConfiguration> auditors = new 
LinkedHashMap<>();
+    
+    private ShardingCacheConfiguration shardingCache;
 }
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheRuleConfiguration.java
 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheConfiguration.java
similarity index 69%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheRuleConfiguration.java
rename to 
features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheConfiguration.java
index 92c6b43c8d8..583c8c4a799 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheRuleConfiguration.java
+++ 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheConfiguration.java
@@ -15,23 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.api;
+package org.apache.shardingsphere.sharding.api.config.cache;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.ToString;
-import 
org.apache.shardingsphere.infra.config.rule.function.EnhancedRuleConfiguration;
-import 
org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
 
 /**
- * Configuration for sharding cache rule.
+ * Configuration for sharding cache.
  */
 @RequiredArgsConstructor
 @Getter
 @ToString
-public final class ShardingCacheRuleConfiguration implements 
DatabaseRuleConfiguration, EnhancedRuleConfiguration {
+public final class ShardingCacheConfiguration {
     
     private final int allowedMaxSqlLength;
     
-    private final ShardingCacheOptions routeCache;
+    private final ShardingCacheOptionsConfiguration routeCache;
 }
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheOptions.java
 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheOptionsConfiguration.java
similarity index 90%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheOptions.java
rename to 
features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheOptionsConfiguration.java
index ce27310a5f0..124faf055ce 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/api/ShardingCacheOptions.java
+++ 
b/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/api/config/cache/ShardingCacheOptionsConfiguration.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.api;
+package org.apache.shardingsphere.sharding.api.config.cache;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -27,7 +27,7 @@ import lombok.ToString;
 @RequiredArgsConstructor
 @Getter
 @ToString
-public final class ShardingCacheOptions {
+public final class ShardingCacheOptionsConfiguration {
     
     private final boolean softValues;
     
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/ShardingCacheRule.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
similarity index 70%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/ShardingCacheRule.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
index e8295e51609..cecbce33be6 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/ShardingCacheRule.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.rule;
+package org.apache.shardingsphere.sharding.cache;
 
 import lombok.Getter;
-import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
 import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableChecker;
 import org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCache;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.timeservice.core.rule.TimeServiceRule;
+import 
org.apache.shardingsphere.timeservice.core.rule.builder.DefaultTimeServiceConfigurationBuilder;
 
 /**
- * Sharding cache rule.
+ * <strong>EXPERIMENTAL</strong> Sharding cache.
  */
 @Getter
-public final class ShardingCacheRule implements DatabaseRule {
+public final class ShardingCache {
     
-    private final ShardingCacheRuleConfiguration configuration;
+    private final ShardingCacheConfiguration configuration;
     
     private final ShardingRule shardingRule;
     
@@ -41,16 +41,11 @@ public final class ShardingCacheRule implements 
DatabaseRule {
     
     private final ShardingRouteCache routeCache;
     
-    public ShardingCacheRule(final ShardingCacheRuleConfiguration 
configuration, final ShardingRule shardingRule, final TimeServiceRule 
timeServiceRule) {
+    public ShardingCache(final ShardingCacheConfiguration configuration, final 
ShardingRule shardingRule) {
         this.configuration = configuration;
         this.shardingRule = shardingRule;
-        this.timeServiceRule = timeServiceRule;
+        timeServiceRule = new TimeServiceRule(new 
DefaultTimeServiceConfigurationBuilder().build());
         routeCacheableChecker = new ShardingRouteCacheableChecker(this);
         routeCache = new ShardingRouteCache(configuration.getRouteCache());
     }
-    
-    @Override
-    public String getType() {
-        return ShardingCacheRule.class.getSimpleName();
-    }
 }
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckResult.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckResult.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckResult.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckResult.java
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
similarity index 96%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
index 7cdcbb68c03..36bbe8f41c5 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableChecker.java
@@ -22,7 +22,6 @@ import com.github.benmanes.caffeine.cache.LoadingCache;
 import com.google.common.collect.Range;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
-import org.apache.shardingsphere.infra.session.query.QueryContext;
 import 
org.apache.shardingsphere.infra.binder.segment.insert.keygen.GeneratedKeyContext;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.DeleteStatementContext;
@@ -30,9 +29,10 @@ import 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementConte
 import 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.UpdateStatementContext;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
+import org.apache.shardingsphere.sharding.cache.ShardingCache;
 import 
org.apache.shardingsphere.sharding.cache.checker.algorithm.CacheableShardingAlgorithmChecker;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
 import 
org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
 import 
org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine;
 import 
org.apache.shardingsphere.sharding.route.engine.condition.engine.WhereClauseShardingConditionEngine;
@@ -67,13 +67,13 @@ public final class ShardingRouteCacheableChecker {
     
     private final LoadingCache<Key, ShardingRouteCacheableCheckResult> 
checkingCache;
     
-    public ShardingRouteCacheableChecker(final ShardingCacheRule 
shardingCacheRule) {
-        shardingRule = shardingCacheRule.getShardingRule();
-        timeServiceRule = shardingCacheRule.getTimeServiceRule();
-        checkingCache = 
buildCache(shardingCacheRule.getConfiguration().getRouteCache());
+    public ShardingRouteCacheableChecker(final ShardingCache shardingCache) {
+        shardingRule = shardingCache.getShardingRule();
+        timeServiceRule = shardingCache.getTimeServiceRule();
+        checkingCache = 
buildCache(shardingCache.getConfiguration().getRouteCache());
     }
     
-    private LoadingCache<Key, ShardingRouteCacheableCheckResult> 
buildCache(final ShardingCacheOptions cacheOptions) {
+    private LoadingCache<Key, ShardingRouteCacheableCheckResult> 
buildCache(final ShardingCacheOptionsConfiguration cacheOptions) {
         Caffeine<Object, Object> result = 
Caffeine.newBuilder().initialCapacity(cacheOptions.getInitialCapacity()).maximumSize(cacheOptions.getMaximumSize());
         if (cacheOptions.isSoftValues()) {
             result.softValues();
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmChecker.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmChecker.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmChecker.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmChecker.java
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmClassProvider.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmClassProvider.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmClassProvider.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/CacheableShardingAlgorithmClassProvider.java
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/impl/BuiltInCacheableShardingAlgorithmClassProvider.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/impl/BuiltInCacheableShardingAlgorithmClassProvider.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/impl/BuiltInCacheableShardingAlgorithmClassProvider.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/checker/algorithm/impl/BuiltInCacheableShardingAlgorithmClassProvider.java
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
similarity index 50%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
index 09c3e42e015..7699d2f5d8d 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouter.java
@@ -17,55 +17,64 @@
 
 package org.apache.shardingsphere.sharding.cache.route;
 
-import org.apache.shardingsphere.infra.session.query.QueryContext;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
-import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
+import org.apache.shardingsphere.sharding.cache.ShardingCache;
 import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableCheckResult;
 import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheKey;
 import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheValue;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
-import org.apache.shardingsphere.sharding.constant.ShardingOrder;
-import org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 
 /**
- * TODO Design a cache layer interface in kernel.
  * Cached sharding SQL router.
  */
-public final class CachedShardingSQLRouter implements 
SQLRouter<ShardingCacheRule> {
+public final class CachedShardingSQLRouter {
     
-    @Override
-    public RouteContext createRouteContext(final QueryContext queryContext, 
final ShardingSphereRuleMetaData globalRuleMetaData,
-                                           final ShardingSphereDatabase 
database, final ShardingCacheRule rule, final ConfigurationProperties props, 
final ConnectionContext connectionContext) {
-        if (queryContext.getSql().length() > 
rule.getConfiguration().getAllowedMaxSqlLength()) {
-            return new RouteContext();
+    /**
+     * Find {@link RouteContext} from cache or calculate and try caching.
+     *
+     * @param originSQLRouter origin SQL router
+     * @param queryContext query context
+     * @param globalRuleMetaData global rule meta data
+     * @param database database
+     * @param shardingCache sharding cache
+     * @param props configuration properties
+     * @param connectionContext connection context
+     * @return route context
+     */
+    public Optional<RouteContext> loadRouteContext(final OriginSQLRouter 
originSQLRouter, final QueryContext queryContext, final 
ShardingSphereRuleMetaData globalRuleMetaData,
+                                                   final 
ShardingSphereDatabase database, final ShardingCache shardingCache, final 
ConfigurationProperties props,
+                                                   final ConnectionContext 
connectionContext) {
+        if (queryContext.getSql().length() > 
shardingCache.getConfiguration().getAllowedMaxSqlLength()) {
+            return Optional.empty();
         }
-        ShardingRouteCacheableCheckResult cacheableCheckResult = 
rule.getRouteCacheableChecker().check(database, queryContext);
+        ShardingRouteCacheableCheckResult cacheableCheckResult = 
shardingCache.getRouteCacheableChecker().check(database, queryContext);
         if (!cacheableCheckResult.isProbablyCacheable()) {
-            return new RouteContext();
+            return Optional.empty();
         }
         List<Object> shardingConditionParams = new 
ArrayList<>(cacheableCheckResult.getShardingConditionParameterMarkerIndexes().size());
         for (int each : 
cacheableCheckResult.getShardingConditionParameterMarkerIndexes()) {
             if (each >= queryContext.getParameters().size()) {
-                return new RouteContext();
+                return Optional.empty();
             }
             
shardingConditionParams.add(queryContext.getParameters().get(each));
         }
-        Optional<RouteContext> cachedRouteContext = 
rule.getRouteCache().get(new ShardingRouteCacheKey(queryContext.getSql(), 
shardingConditionParams))
+        Optional<RouteContext> cachedResult = 
shardingCache.getRouteCache().get(new 
ShardingRouteCacheKey(queryContext.getSql(), shardingConditionParams))
                 .flatMap(ShardingRouteCacheValue::getCachedRouteContext);
-        RouteContext result = cachedRouteContext.orElseGet(
-                () -> new ShardingSQLRouter().createRouteContext(queryContext, 
globalRuleMetaData, database, rule.getShardingRule(), props, 
connectionContext));
-        if (!cachedRouteContext.isPresent() && hitOneShardOnly(result)) {
-            rule.getRouteCache().put(new 
ShardingRouteCacheKey(queryContext.getSql(), shardingConditionParams), new 
ShardingRouteCacheValue(result));
+        RouteContext result = cachedResult.orElseGet(
+                () -> originSQLRouter.createRouteContext(queryContext, 
globalRuleMetaData, database, shardingCache.getShardingRule(), props, 
connectionContext));
+        if (!cachedResult.isPresent() && hitOneShardOnly(result)) {
+            shardingCache.getRouteCache().put(new 
ShardingRouteCacheKey(queryContext.getSql(), shardingConditionParams), new 
ShardingRouteCacheValue(result));
         }
-        return result;
+        return Optional.of(result);
     }
     
     private boolean hitOneShardOnly(final RouteContext routeContext) {
@@ -73,18 +82,21 @@ public final class CachedShardingSQLRouter implements 
SQLRouter<ShardingCacheRul
                 && 1 == routeContext.getOriginalDataNodes().size() && 1 == 
routeContext.getOriginalDataNodes().iterator().next().size();
     }
     
-    @Override
-    public void decorateRouteContext(final RouteContext routeContext, final 
QueryContext queryContext, final ShardingSphereDatabase database, final 
ShardingCacheRule rule,
-                                     final ConfigurationProperties props, 
final ConnectionContext connectionContext) {
-    }
-    
-    @Override
-    public int getOrder() {
-        return ShardingOrder.ORDER - 1;
-    }
-    
-    @Override
-    public Class<ShardingCacheRule> getTypeClass() {
-        return ShardingCacheRule.class;
+    @FunctionalInterface
+    public interface OriginSQLRouter {
+        
+        /**
+         * Create route context.
+         *
+         * @param queryContext query context
+         * @param globalRuleMetaData global rule meta data
+         * @param database database
+         * @param rule rule
+         * @param props configuration properties
+         * @param connectionContext connection context
+         * @return route context
+         */
+        RouteContext createRouteContext(QueryContext queryContext, 
ShardingSphereRuleMetaData globalRuleMetaData, ShardingSphereDatabase database, 
ShardingRule rule,
+                                        ConfigurationProperties props, 
ConnectionContext connectionContext);
     }
 }
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
similarity index 89%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
index 2be40ea2c29..7939b7b07c9 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCache.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.sharding.cache.route.cache;
 
 import com.github.benmanes.caffeine.cache.Cache;
 import com.github.benmanes.caffeine.cache.Caffeine;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
 
 import java.util.Optional;
 
@@ -30,11 +30,11 @@ public final class ShardingRouteCache {
     
     private final Cache<ShardingRouteCacheKey, ShardingRouteCacheValue> cache;
     
-    public ShardingRouteCache(final ShardingCacheOptions cacheOptions) {
+    public ShardingRouteCache(final ShardingCacheOptionsConfiguration 
cacheOptions) {
         cache = buildRouteCache(cacheOptions);
     }
     
-    private Cache<ShardingRouteCacheKey, ShardingRouteCacheValue> 
buildRouteCache(final ShardingCacheOptions cacheOptions) {
+    private Cache<ShardingRouteCacheKey, ShardingRouteCacheValue> 
buildRouteCache(final ShardingCacheOptionsConfiguration cacheOptions) {
         Caffeine<Object, Object> result = 
Caffeine.newBuilder().initialCapacity(cacheOptions.getInitialCapacity()).maximumSize(cacheOptions.getMaximumSize());
         if (cacheOptions.isSoftValues()) {
             result.softValues();
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheKey.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheKey.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheKey.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheKey.java
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheValue.java
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
index ca6626ba823..740362579d9 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
@@ -17,14 +17,15 @@
 
 package org.apache.shardingsphere.sharding.route.engine;
 
-import org.apache.shardingsphere.infra.session.query.QueryContext;
 import org.apache.shardingsphere.infra.binder.type.CursorAvailable;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
+import org.apache.shardingsphere.sharding.cache.route.CachedShardingSQLRouter;
 import org.apache.shardingsphere.sharding.constant.ShardingOrder;
 import 
org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
 import 
org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditions;
@@ -45,10 +46,22 @@ import java.util.Optional;
  */
 public final class ShardingSQLRouter implements SQLRouter<ShardingRule> {
     
-    @SuppressWarnings({"rawtypes", "unchecked"})
     @Override
     public RouteContext createRouteContext(final QueryContext queryContext, 
final ShardingSphereRuleMetaData globalRuleMetaData, final 
ShardingSphereDatabase database, final ShardingRule rule,
                                            final ConfigurationProperties 
props, final ConnectionContext connectionContext) {
+        if (rule.isShardingCacheEnabled()) {
+            Optional<RouteContext> result = new CachedShardingSQLRouter()
+                    .loadRouteContext(this::createRouteContext0, queryContext, 
globalRuleMetaData, database, rule.getShardingCache(), props, 
connectionContext);
+            if (result.isPresent()) {
+                return result.get();
+            }
+        }
+        return createRouteContext0(queryContext, globalRuleMetaData, database, 
rule, props, connectionContext);
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private RouteContext createRouteContext0(final QueryContext queryContext, 
final ShardingSphereRuleMetaData globalRuleMetaData, final 
ShardingSphereDatabase database, final ShardingRule rule,
+                                             final ConfigurationProperties 
props, final ConnectionContext connectionContext) {
         SQLStatement sqlStatement = 
queryContext.getSqlStatementContext().getSqlStatement();
         ShardingConditions shardingConditions = 
createShardingConditions(queryContext, globalRuleMetaData, database, rule);
         Optional<ShardingStatementValidator> validator = 
ShardingStatementValidatorFactory.newInstance(sqlStatement, shardingConditions);
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index e35d9c15f0e..1974df66382 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -46,6 +46,7 @@ import 
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShard
 import 
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
 import 
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
+import org.apache.shardingsphere.sharding.cache.ShardingCache;
 import 
org.apache.shardingsphere.sharding.exception.algorithm.keygen.GenerateKeyStrategyNotFoundException;
 import 
org.apache.shardingsphere.sharding.exception.algorithm.sharding.ShardingAlgorithmClassImplementationException;
 import 
org.apache.shardingsphere.sharding.exception.metadata.InvalidBindingTablesException;
@@ -114,6 +115,8 @@ public final class ShardingRule implements DatabaseRule, 
DataNodeContainedRule,
     
     private final Map<String, Collection<DataNode>> shardingTableDataNodes;
     
+    private final ShardingCache shardingCache;
+    
     public ShardingRule(final ShardingRuleConfiguration ruleConfig, final 
Collection<String> dataSourceNames, final InstanceContext instanceContext) {
         configuration = ruleConfig;
         this.dataSourceNames = getDataSourceNames(ruleConfig.getTables(), 
ruleConfig.getAutoTables(), dataSourceNames);
@@ -139,6 +142,7 @@ public final class ShardingRule implements DatabaseRule, 
DataNodeContainedRule,
         if (defaultKeyGenerateAlgorithm instanceof InstanceContextAware && -1 
== instanceContext.getWorkerId()) {
             ((InstanceContextAware) 
defaultKeyGenerateAlgorithm).setInstanceContext(instanceContext);
         }
+        shardingCache = null != ruleConfig.getShardingCache() ? new 
ShardingCache(ruleConfig.getShardingCache(), this) : null;
     }
     
     private Map<String, Collection<DataNode>> 
createShardingTableDataNodes(final Map<String, TableRule> tableRules) {
@@ -763,6 +767,15 @@ public final class ShardingRule implements DatabaseRule, 
DataNodeContainedRule,
         return binaryExpression.getLeft() instanceof ColumnSegment && 
binaryExpression.getRight() instanceof ColumnSegment && 
"=".equals(binaryExpression.getOperator());
     }
     
+    /**
+     * Is sharding cache enabled.
+     *
+     * @return is sharding cache enabled
+     */
+    public boolean isShardingCacheEnabled() {
+        return null != shardingCache;
+    }
+    
     @Override
     public String getType() {
         return ShardingRule.class.getSimpleName();
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
index c3ff5692a8d..7d1974b3f6e 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
@@ -22,6 +22,7 @@ import lombok.Setter;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlShardingAutoTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.strategy.audit.YamlShardingAuditStrategyConfiguration;
@@ -64,6 +65,8 @@ public final class YamlShardingRuleConfiguration implements 
YamlRuleConfiguratio
     
     private String defaultShardingColumn;
     
+    private YamlShardingCacheConfiguration shardingCache;
+    
     @Override
     public Class<ShardingRuleConfiguration> getRuleConfigurationType() {
         return ShardingRuleConfiguration.class;
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheConfiguration.java
similarity index 76%
copy from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
copy to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheConfiguration.java
index ea3c11385e8..a8defae5a59 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheConfiguration.java
@@ -15,22 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.yaml;
+package org.apache.shardingsphere.sharding.yaml.config.cache;
 
 import lombok.Getter;
 import lombok.Setter;
 import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
 
 /**
- * Sharding cache options configuration for YAML.
+ * Sharding cache configuration for YAML.
  */
 @Getter
 @Setter
-public final class YamlShardingCacheOptionsConfiguration implements 
YamlConfiguration {
+public final class YamlShardingCacheConfiguration implements YamlConfiguration 
{
     
-    private boolean softValues;
+    private int allowedMaxSqlLength;
     
-    private int initialCapacity;
-    
-    private int maximumSize;
+    private YamlShardingCacheOptionsConfiguration routeCache;
 }
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheOptionsConfiguration.java
similarity index 95%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheOptionsConfiguration.java
index ea3c11385e8..10864744088 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheOptionsConfiguration.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/cache/YamlShardingCacheOptionsConfiguration.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.yaml;
+package org.apache.shardingsphere.sharding.yaml.config.cache;
 
 import lombok.Getter;
 import lombok.Setter;
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleConfigurationSwapper.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleConfigurationSwapper.java
index 26755eb8775..547d5177585 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleConfigurationSwapper.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleConfigurationSwapper.java
@@ -24,6 +24,7 @@ import 
org.apache.shardingsphere.sharding.constant.ShardingOrder;
 import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlShardingAutoTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.swapper.cache.YamlShardingCacheConfigurationSwapper;
 import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingAutoTableRuleConfigurationSwapper;
 import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableReferenceRuleConfigurationConverter;
 import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableRuleConfigurationSwapper;
@@ -51,6 +52,8 @@ public final class YamlShardingRuleConfigurationSwapper 
implements YamlRuleConfi
     
     private final YamlShardingAutoTableRuleConfigurationSwapper 
autoTableYamlSwapper = new YamlShardingAutoTableRuleConfigurationSwapper();
     
+    private final YamlShardingCacheConfigurationSwapper 
shardingCacheYamlSwapper = new YamlShardingCacheConfigurationSwapper();
+    
     @Override
     public YamlShardingRuleConfiguration swapToYamlConfiguration(final 
ShardingRuleConfiguration data) {
         YamlShardingRuleConfiguration result = new 
YamlShardingRuleConfiguration();
@@ -61,6 +64,9 @@ public final class YamlShardingRuleConfigurationSwapper 
implements YamlRuleConfi
         setYamlStrategies(data, result);
         setYamlAlgorithms(data, result);
         result.setDefaultShardingColumn(data.getDefaultShardingColumn());
+        if (null != data.getShardingCache()) {
+            
result.setShardingCache(shardingCacheYamlSwapper.swapToYamlConfiguration(data.getShardingCache()));
+        }
         return result;
     }
     
@@ -109,6 +115,9 @@ public final class YamlShardingRuleConfigurationSwapper 
implements YamlRuleConfi
         setStrategies(yamlConfig, result);
         setAlgorithms(yamlConfig, result);
         result.setDefaultShardingColumn(yamlConfig.getDefaultShardingColumn());
+        if (null != yamlConfig.getShardingCache()) {
+            
result.setShardingCache(shardingCacheYamlSwapper.swapToObject(yamlConfig.getShardingCache()));
+        }
         return result;
     }
     
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapper.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapper.java
new file mode 100644
index 00000000000..b604dbf4231
--- /dev/null
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapper.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.yaml.swapper.cache;
+
+import 
org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
+
+/**
+ * YAML sharding cache configuration swapper.
+ */
+public final class YamlShardingCacheConfigurationSwapper implements 
YamlConfigurationSwapper<YamlShardingCacheConfiguration, 
ShardingCacheConfiguration> {
+    
+    private final YamlShardingCacheOptionsConfigurationSwapper 
cacheOptionsConfigurationSwapper = new 
YamlShardingCacheOptionsConfigurationSwapper();
+    
+    @Override
+    public YamlShardingCacheConfiguration swapToYamlConfiguration(final 
ShardingCacheConfiguration data) {
+        YamlShardingCacheConfiguration result = new 
YamlShardingCacheConfiguration();
+        result.setAllowedMaxSqlLength(data.getAllowedMaxSqlLength());
+        
result.setRouteCache(cacheOptionsConfigurationSwapper.swapToYamlConfiguration(data.getRouteCache()));
+        return result;
+    }
+    
+    @Override
+    public ShardingCacheConfiguration swapToObject(final 
YamlShardingCacheConfiguration yamlConfig) {
+        return new 
ShardingCacheConfiguration(yamlConfig.getAllowedMaxSqlLength(), 
cacheOptionsConfigurationSwapper.swapToObject(yamlConfig.getRouteCache()));
+    }
+}
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapper.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapper.java
similarity index 70%
rename from 
features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapper.java
rename to 
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapper.java
index d016deca3ce..03173a3489e 100644
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapper.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapper.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.yaml.swapper;
+package org.apache.shardingsphere.sharding.yaml.swapper.cache;
 
 import 
org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
-import 
org.apache.shardingsphere.sharding.cache.yaml.YamlShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheOptionsConfiguration;
 
 /**
  * YAML sharding cache options configuration swapper.
  */
-public final class YamlShardingCacheOptionsConfigurationSwapper implements 
YamlConfigurationSwapper<YamlShardingCacheOptionsConfiguration, 
ShardingCacheOptions> {
+public final class YamlShardingCacheOptionsConfigurationSwapper implements 
YamlConfigurationSwapper<YamlShardingCacheOptionsConfiguration, 
ShardingCacheOptionsConfiguration> {
     
     @Override
-    public YamlShardingCacheOptionsConfiguration swapToYamlConfiguration(final 
ShardingCacheOptions data) {
+    public YamlShardingCacheOptionsConfiguration swapToYamlConfiguration(final 
ShardingCacheOptionsConfiguration data) {
         YamlShardingCacheOptionsConfiguration result = new 
YamlShardingCacheOptionsConfiguration();
         result.setSoftValues(data.isSoftValues());
         result.setInitialCapacity(data.getInitialCapacity());
@@ -36,7 +36,7 @@ public final class 
YamlShardingCacheOptionsConfigurationSwapper implements YamlC
     }
     
     @Override
-    public ShardingCacheOptions swapToObject(final 
YamlShardingCacheOptionsConfiguration yamlConfig) {
-        return new ShardingCacheOptions(yamlConfig.isSoftValues(), 
yamlConfig.getInitialCapacity(), yamlConfig.getMaximumSize());
+    public ShardingCacheOptionsConfiguration swapToObject(final 
YamlShardingCacheOptionsConfiguration yamlConfig) {
+        return new 
ShardingCacheOptionsConfiguration(yamlConfig.isSoftValues(), 
yamlConfig.getInitialCapacity(), yamlConfig.getMaximumSize());
     }
 }
diff --git 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.cache.checker.algorithm.CacheableShardingAlgorithmClassProvider
 
b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.cache.checker.algorithm.CacheableShardingAlgorithmClassProvider
similarity index 100%
rename from 
features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.cache.checker.algorithm.CacheableShardingAlgorithmClassProvider
rename to 
features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.cache.checker.algorithm.CacheableShardingAlgorithmClassProvider
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
similarity index 93%
rename from 
features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
rename to 
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
index aae67f089ac..a6153b00622 100644
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/checker/ShardingRouteCacheableCheckerTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.cache.checker;
 
-import org.apache.shardingsphere.infra.session.query.QueryContext;
 import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
@@ -32,14 +31,14 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sql.parser.api.CacheOption;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -76,10 +75,9 @@ class ShardingRouteCacheableCheckerTest {
     @ArgumentsSource(TestCaseArgumentsProvider.class)
     void assertCheckCacheable(final String sql, final List<Object> parameters, 
final boolean expectedProbablyCacheable, final List<Integer> 
expectedShardingConditionParameterMarkerIndexes) {
         ShardingRule shardingRule = createShardingRule();
-        ShardingCacheRule shardingCacheRule = 
createShardingCacheRule(shardingRule);
         TimeServiceRule timeServiceRule = createTimeServiceRule();
-        ShardingSphereDatabase database = createDatabase(shardingRule, 
shardingCacheRule, timeServiceRule);
-        ShardingRouteCacheableCheckResult actual = new 
ShardingRouteCacheableChecker(shardingCacheRule).check(database, 
createQueryContext(database, sql, parameters));
+        ShardingSphereDatabase database = createDatabase(shardingRule, 
timeServiceRule);
+        ShardingRouteCacheableCheckResult actual = new 
ShardingRouteCacheableChecker(shardingRule.getShardingCache()).check(database, 
createQueryContext(database, sql, parameters));
         assertThat(actual.isProbablyCacheable(), 
is(expectedProbablyCacheable));
         assertThat(actual.getShardingConditionParameterMarkerIndexes(), 
is(expectedShardingConditionParameterMarkerIndexes));
     }
@@ -102,19 +100,15 @@ class ShardingRouteCacheableCheckerTest {
         ShardingTableRuleConfiguration nonCacheableTableSharding = new 
ShardingTableRuleConfiguration("t_non_cacheable_table_sharding", 
"ds_0.t_non_cacheable_table_sharding_${0..1}");
         nonCacheableTableSharding.setTableShardingStrategy(new 
StandardShardingStrategyConfiguration("id", "inline"));
         ruleConfig.getTables().add(nonCacheableTableSharding);
+        ruleConfig.setShardingCache(new ShardingCacheConfiguration(100, new 
ShardingCacheOptionsConfiguration(true, 0, 0)));
         return new ShardingRule(ruleConfig, Arrays.asList("ds_0", "ds_1"), new 
InstanceContext(mock(ComputeNodeInstance.class), props -> 0, null, null, null, 
null));
     }
     
-    private ShardingCacheRule createShardingCacheRule(final ShardingRule 
shardingRule) {
-        return new ShardingCacheRule(new ShardingCacheRuleConfiguration(100, 
new ShardingCacheOptions(true, 0, 0)), shardingRule,
-                new TimeServiceRule(new TimeServiceRuleConfiguration("System", 
new Properties())));
-    }
-    
     private TimeServiceRule createTimeServiceRule() {
         return new TimeServiceRule(new TimeServiceRuleConfiguration("System", 
new Properties()));
     }
     
-    private ShardingSphereDatabase createDatabase(final ShardingRule 
shardingRule, final ShardingCacheRule shardingCacheRule, final TimeServiceRule 
timeServiceRule) {
+    private ShardingSphereDatabase createDatabase(final ShardingRule 
shardingRule, final TimeServiceRule timeServiceRule) {
         ShardingSphereSchema schema = new ShardingSphereSchema();
         schema.getTables().put("t_broadcast_table", new 
ShardingSphereTable("t_broadcast_table", Arrays.asList(
                 new ShardingSphereColumn("broadcast_table_id", Types.INTEGER, 
true, false, false, true, false),
@@ -132,7 +126,7 @@ class ShardingRouteCacheableCheckerTest {
                 new ShardingSphereColumn("order_broadcast_table_id", 
Types.INTEGER, true, false, false, true, false)),
                 Collections.emptyList(), Collections.emptyList()));
         return new ShardingSphereDatabase(DATABASE_NAME, 
TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"),
-                new ShardingSphereResourceMetaData(DATABASE_NAME, 
Collections.emptyMap()), new 
ShardingSphereRuleMetaData(Arrays.asList(shardingRule, shardingCacheRule, 
timeServiceRule)),
+                new ShardingSphereResourceMetaData(DATABASE_NAME, 
Collections.emptyMap()), new 
ShardingSphereRuleMetaData(Arrays.asList(shardingRule, timeServiceRule)),
                 Collections.singletonMap(SCHEMA_NAME, schema));
     }
     
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
new file mode 100644
index 00000000000..bdb37a9876e
--- /dev/null
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.cache.route;
+
+import org.apache.shardingsphere.infra.datanode.DataNode;
+import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.infra.route.context.RouteMapper;
+import org.apache.shardingsphere.infra.route.context.RouteUnit;
+import org.apache.shardingsphere.infra.session.query.QueryContext;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
+import org.apache.shardingsphere.sharding.cache.ShardingCache;
+import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableCheckResult;
+import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableChecker;
+import 
org.apache.shardingsphere.sharding.cache.route.CachedShardingSQLRouter.OriginSQLRouter;
+import org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCache;
+import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheKey;
+import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheValue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+class CachedShardingSQLRouterTest {
+    
+    @Mock
+    private ShardingCache shardingCache;
+    
+    @Test
+    void assertCreateRouteContextWithSQLExceedMaxAllowedLength() {
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(1, null));
+        QueryContext queryContext = new QueryContext(null, "select 1", 
Collections.emptyList());
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(null, queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCache, null, null);
+        assertFalse(actual.isPresent());
+    }
+    
+    @Test
+    void assertCreateRouteContextWithNotCacheableQuery() {
+        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?), (?)", Collections.emptyList());
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(100, null));
+        
when(shardingCache.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
+        when(shardingCache.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(false, 
Collections.emptyList()));
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(null, queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCache, null, null);
+        assertFalse(actual.isPresent());
+    }
+    
+    @Test
+    void assertCreateRouteContextWithUnmatchedActualParameterSize() {
+        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Collections.singletonList(0));
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(100, null));
+        
when(shardingCache.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
+        when(shardingCache.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(null, queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCache, null, null);
+        assertFalse(actual.isPresent());
+    }
+    
+    @Test
+    void assertCreateRouteContextWithCacheableQueryButCacheMissed() {
+        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Arrays.asList(0, 1));
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(100, null));
+        
when(shardingCache.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
+        when(shardingCache.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
+        
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
+        RouteContext expected = new RouteContext();
+        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
+        
when(shardingCache.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.empty());
+        OriginSQLRouter router = (unused, globalRuleMetaData, database, rule, 
props, connectionContext) -> expected;
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(router, queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCache, null, null);
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), is(expected));
+        
verify(shardingCache.getRouteCache()).put(any(ShardingRouteCacheKey.class), 
any(ShardingRouteCacheValue.class));
+    }
+    
+    @Test
+    void assertCreateRouteContextWithCacheHit() {
+        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Arrays.asList(0, 1));
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(100, null));
+        
when(shardingCache.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
+        when(shardingCache.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
+        
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
+        RouteContext expected = new RouteContext();
+        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
+        
when(shardingCache.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.of(new
 ShardingRouteCacheValue(expected)));
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(null, queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCache, null, null);
+        assertTrue(actual.isPresent());
+        RouteContext actualRouteContext = actual.get();
+        assertThat(actualRouteContext, not(expected));
+        assertThat(actualRouteContext.getOriginalDataNodes(), 
is(expected.getOriginalDataNodes()));
+        assertThat(actualRouteContext.getRouteUnits(), 
is(expected.getRouteUnits()));
+    }
+    
+    @Test
+    void assertCreateRouteContextWithQueryRoutedToMultiDataNodes() {
+        QueryContext queryContext = new QueryContext(null, "select * from t", 
Collections.emptyList());
+        when(shardingCache.getConfiguration()).thenReturn(new 
ShardingCacheConfiguration(100, null));
+        
when(shardingCache.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
+        when(shardingCache.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.emptyList()));
+        
when(shardingCache.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
+        RouteContext expected = new RouteContext();
+        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Arrays.asList(new RouteMapper("t", "t_0"), new RouteMapper("t", 
"t_1"))));
+        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t_0")));
+        OriginSQLRouter router = (unused, globalRuleMetaData, database, rule, 
props, connectionContext) -> expected;
+        ShardingSphereRuleMetaData globalRuleMetaData = 
mock(ShardingSphereRuleMetaData.class);
+        Optional<RouteContext> actual = new 
CachedShardingSQLRouter().loadRouteContext(router, queryContext, 
globalRuleMetaData, null, shardingCache, null, null);
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), is(expected));
+        verify(shardingCache.getRouteCache(), 
never()).put(any(ShardingRouteCacheKey.class), 
any(ShardingRouteCacheValue.class));
+    }
+}
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
similarity index 91%
rename from 
features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
rename to 
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
index 6105b89c6ad..86da79be48e 100644
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/cache/route/cache/ShardingRouteCacheTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.sharding.cache.route.cache;
 
 import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
 import org.junit.jupiter.api.Test;
 
 import java.util.Collections;
@@ -30,7 +30,7 @@ class ShardingRouteCacheTest {
     
     @Test
     void assertPutAndGet() {
-        ShardingRouteCache cache = new ShardingRouteCache(new 
ShardingCacheOptions(true, 1, 1));
+        ShardingRouteCache cache = new ShardingRouteCache(new 
ShardingCacheOptionsConfiguration(true, 1, 1));
         ShardingRouteCacheKey key = new ShardingRouteCacheKey("select name 
from t where id = ?", Collections.singletonList(1));
         assertFalse(cache.get(key).isPresent());
         cache.put(key, new ShardingRouteCacheValue(new RouteContext()));
diff --git 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
index f1dcae5efc4..b31eab98237 100644
--- 
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
@@ -20,6 +20,8 @@ package org.apache.shardingsphere.sharding.yaml;
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheOptionsConfiguration;
 import org.apache.shardingsphere.test.it.yaml.YamlRuleConfigurationIT;
 
 import java.util.Optional;
@@ -47,6 +49,7 @@ class ShardingRuleConfigurationYamlIT extends 
YamlRuleConfigurationIT {
         assertTOrderItem(shardingRuleConfig.get());
         assertBindingTable(shardingRuleConfig.get());
         assertBroadcastTable(shardingRuleConfig.get());
+        assertShardingCache(shardingRuleConfig.get());
         assertProps(actual);
         assertThat(shardingRuleConfig.get().getDefaultShardingColumn(), 
is("order_id"));
     }
@@ -97,6 +100,15 @@ class ShardingRuleConfigurationYamlIT extends 
YamlRuleConfigurationIT {
         assertThat(actual.getBroadcastTables().iterator().next(), 
is("t_config"));
     }
     
+    private void assertShardingCache(final YamlShardingRuleConfiguration 
actual) {
+        YamlShardingCacheConfiguration actualShardingCache = 
actual.getShardingCache();
+        assertThat(actualShardingCache.getAllowedMaxSqlLength(), is(512));
+        YamlShardingCacheOptionsConfiguration actualRouteCacheConfiguration = 
actualShardingCache.getRouteCache();
+        assertThat(actualRouteCacheConfiguration.getInitialCapacity(), 
is(65536));
+        assertThat(actualRouteCacheConfiguration.getMaximumSize(), is(262144));
+        assertTrue(actualRouteCacheConfiguration.isSoftValues());
+    }
+    
     private void assertProps(final YamlRootConfiguration actual) {
         assertThat(actual.getProps().size(), is(1));
         assertTrue((boolean) 
actual.getProps().get(ConfigurationPropertyKey.SQL_SHOW.getKey()));
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapperTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapperTest.java
similarity index 56%
rename from 
features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapperTest.java
rename to 
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapperTest.java
index b03e72da144..239559f46ee 100644
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapperTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheConfigurationSwapperTest.java
@@ -15,25 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.yaml.swapper;
+package org.apache.shardingsphere.sharding.yaml.swapper.cache;
 
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.cache.yaml.YamlShardingCacheOptionsConfiguration;
-import 
org.apache.shardingsphere.sharding.cache.yaml.YamlShardingCacheRuleConfiguration;
-import org.hamcrest.CoreMatchers;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-class YamlShardingCacheRuleConfigurationSwapperTest {
+class YamlShardingCacheConfigurationSwapperTest {
     
     @Test
     void assertSwapToYamlConfiguration() {
-        YamlShardingCacheRuleConfiguration actual = new 
YamlShardingCacheRuleConfigurationSwapper()
-                .swapToYamlConfiguration(new 
ShardingCacheRuleConfiguration(100, new ShardingCacheOptions(true, 128, 1024)));
+        YamlShardingCacheConfiguration actual = new 
YamlShardingCacheConfigurationSwapper()
+                .swapToYamlConfiguration(new ShardingCacheConfiguration(100, 
new ShardingCacheOptionsConfiguration(true, 128, 1024)));
         assertThat(actual.getAllowedMaxSqlLength(), is(100));
         YamlShardingCacheOptionsConfiguration actualRouteCache = 
actual.getRouteCache();
         assertTrue(actualRouteCache.isSoftValues());
@@ -43,33 +42,18 @@ class YamlShardingCacheRuleConfigurationSwapperTest {
     
     @Test
     void assertSwapToObject() {
-        YamlShardingCacheRuleConfiguration input = new 
YamlShardingCacheRuleConfiguration();
+        YamlShardingCacheConfiguration input = new 
YamlShardingCacheConfiguration();
         input.setAllowedMaxSqlLength(200);
         YamlShardingCacheOptionsConfiguration yamlConfig = new 
YamlShardingCacheOptionsConfiguration();
         yamlConfig.setSoftValues(true);
         yamlConfig.setInitialCapacity(256);
         yamlConfig.setMaximumSize(4096);
         input.setRouteCache(yamlConfig);
-        ShardingCacheRuleConfiguration actual = new 
YamlShardingCacheRuleConfigurationSwapper().swapToObject(input);
+        ShardingCacheConfiguration actual = new 
YamlShardingCacheConfigurationSwapper().swapToObject(input);
         assertThat(actual.getAllowedMaxSqlLength(), is(200));
-        ShardingCacheOptions actualOptions = actual.getRouteCache();
+        ShardingCacheOptionsConfiguration actualOptions = 
actual.getRouteCache();
         assertTrue(actualOptions.isSoftValues());
         assertThat(actualOptions.getInitialCapacity(), is(256));
         assertThat(actualOptions.getMaximumSize(), is(4096));
     }
-    
-    @Test
-    void assertGetTypeClass() {
-        assertThat(new 
YamlShardingCacheRuleConfigurationSwapper().getTypeClass(), 
CoreMatchers.<Class<ShardingCacheRuleConfiguration>>is(ShardingCacheRuleConfiguration.class));
-    }
-    
-    @Test
-    void assertGetRuleTagName() {
-        assertThat(new 
YamlShardingCacheRuleConfigurationSwapper().getRuleTagName(), 
is("SHARDING_CACHE"));
-    }
-    
-    @Test
-    void assertGetOrder() {
-        assertThat(new YamlShardingCacheRuleConfigurationSwapper().getOrder(), 
is(-9));
-    }
 }
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapperTest.java
 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapperTest.java
similarity index 80%
rename from 
features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapperTest.java
rename to 
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapperTest.java
index a521559ff2e..1402dda5b56 100644
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheOptionsConfigurationSwapperTest.java
+++ 
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/cache/YamlShardingCacheOptionsConfigurationSwapperTest.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.cache.yaml.swapper;
+package org.apache.shardingsphere.sharding.yaml.swapper.cache;
 
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
-import 
org.apache.shardingsphere.sharding.cache.yaml.YamlShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheOptionsConfiguration;
+import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheOptionsConfiguration;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -29,7 +29,7 @@ class YamlShardingCacheOptionsConfigurationSwapperTest {
     
     @Test
     void assertSwapToYamlConfiguration() {
-        YamlShardingCacheOptionsConfiguration actual = new 
YamlShardingCacheOptionsConfigurationSwapper().swapToYamlConfiguration(new 
ShardingCacheOptions(true, 128, 1024));
+        YamlShardingCacheOptionsConfiguration actual = new 
YamlShardingCacheOptionsConfigurationSwapper().swapToYamlConfiguration(new 
ShardingCacheOptionsConfiguration(true, 128, 1024));
         assertTrue(actual.isSoftValues());
         assertThat(actual.getInitialCapacity(), is(128));
         assertThat(actual.getMaximumSize(), is(1024));
@@ -41,7 +41,7 @@ class YamlShardingCacheOptionsConfigurationSwapperTest {
         input.setSoftValues(true);
         input.setInitialCapacity(256);
         input.setMaximumSize(4096);
-        ShardingCacheOptions actual = new 
YamlShardingCacheOptionsConfigurationSwapper().swapToObject(input);
+        ShardingCacheOptionsConfiguration actual = new 
YamlShardingCacheOptionsConfigurationSwapper().swapToObject(input);
         assertTrue(actual.isSoftValues());
         assertThat(actual.getInitialCapacity(), is(256));
         assertThat(actual.getMaximumSize(), is(4096));
diff --git a/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml 
b/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml
index f6f5e074b36..28305393986 100644
--- a/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml
+++ b/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml
@@ -99,5 +99,12 @@ rules:
     sharding_key_required_auditor:
       type: DML_SHARDING_CONDITIONS
 
+  shardingCache:
+    allowedMaxSqlLength: 512
+    routeCache:
+      initialCapacity: 65536
+      maximumSize: 262144
+      softValues: true
+      
 props:
   sql-show: true
diff --git a/features/sharding/plugin/cache/pom.xml 
b/features/sharding/plugin/cache/pom.xml
deleted file mode 100644
index 644c43bf828..00000000000
--- a/features/sharding/plugin/cache/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-sharding-plugin</artifactId>
-        <version>5.3.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-sharding-cache</artifactId>
-    <name>${project.artifactId}</name>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-sharding-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-test-util</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-parser-sql-postgresql</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilder.java
 
b/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilder.java
deleted file mode 100644
index 511acc470f3..00000000000
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilder.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cache.rule.builder;
-
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import 
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder;
-import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
-import org.apache.shardingsphere.sharding.constant.ShardingOrder;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.timeservice.core.rule.TimeServiceRule;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Builder for sharding cache rule.
- */
-public final class ShardingCacheRuleBuilder implements 
DatabaseRuleBuilder<ShardingCacheRuleConfiguration> {
-    
-    @Override
-    public DatabaseRule build(final ShardingCacheRuleConfiguration config, 
final String databaseName, final Map<String, DataSource> dataSources, final 
Collection<ShardingSphereRule> builtRules,
-                              final InstanceContext instanceContext) {
-        ShardingRule shardingRule = (ShardingRule) 
builtRules.stream().filter(ShardingRule.class::isInstance).findFirst()
-                .orElseThrow(() -> new 
IllegalStateException("ShardingCacheRule requires ShardingRule"));
-        TimeServiceRule timeServiceRule = (TimeServiceRule) 
builtRules.stream().filter(TimeServiceRule.class::isInstance).findFirst()
-                .orElseThrow(() -> new 
IllegalStateException("ShardingCacheRule requires TimeServiceRule"));
-        return new ShardingCacheRule(config, shardingRule, timeServiceRule);
-    }
-    
-    @Override
-    public int getOrder() {
-        return ShardingOrder.ORDER + 1;
-    }
-    
-    @Override
-    public Class<ShardingCacheRuleConfiguration> getTypeClass() {
-        return ShardingCacheRuleConfiguration.class;
-    }
-}
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheRuleConfiguration.java
 
b/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheRuleConfiguration.java
deleted file mode 100644
index 67a4054e32f..00000000000
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/YamlShardingCacheRuleConfiguration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cache.yaml;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-
-/**
- * Sharding cache rule configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlShardingCacheRuleConfiguration implements 
YamlRuleConfiguration {
-    
-    private int allowedMaxSqlLength;
-    
-    private YamlShardingCacheOptionsConfiguration routeCache;
-    
-    @Override
-    public Class<? extends RuleConfiguration> getRuleConfigurationType() {
-        return ShardingCacheRuleConfiguration.class;
-    }
-}
diff --git 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapper.java
 
b/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapper.java
deleted file mode 100644
index 669cb37eb8c..00000000000
--- 
a/features/sharding/plugin/cache/src/main/java/org/apache/shardingsphere/sharding/cache/yaml/swapper/YamlShardingCacheRuleConfigurationSwapper.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cache.yaml.swapper;
-
-import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.cache.yaml.YamlShardingCacheRuleConfiguration;
-import org.apache.shardingsphere.sharding.constant.ShardingOrder;
-
-/**
- * YAML sharding cache rule configuration swapper.
- */
-public final class YamlShardingCacheRuleConfigurationSwapper implements 
YamlRuleConfigurationSwapper<YamlShardingCacheRuleConfiguration, 
ShardingCacheRuleConfiguration> {
-    
-    private final YamlShardingCacheOptionsConfigurationSwapper 
cacheOptionsConfigurationSwapper = new 
YamlShardingCacheOptionsConfigurationSwapper();
-    
-    @Override
-    public YamlShardingCacheRuleConfiguration swapToYamlConfiguration(final 
ShardingCacheRuleConfiguration data) {
-        YamlShardingCacheRuleConfiguration result = new 
YamlShardingCacheRuleConfiguration();
-        result.setAllowedMaxSqlLength(data.getAllowedMaxSqlLength());
-        
result.setRouteCache(cacheOptionsConfigurationSwapper.swapToYamlConfiguration(data.getRouteCache()));
-        return result;
-    }
-    
-    @Override
-    public ShardingCacheRuleConfiguration swapToObject(final 
YamlShardingCacheRuleConfiguration yamlConfig) {
-        return new 
ShardingCacheRuleConfiguration(yamlConfig.getAllowedMaxSqlLength(), 
cacheOptionsConfigurationSwapper.swapToObject(yamlConfig.getRouteCache()));
-    }
-    
-    @Override
-    public Class<ShardingCacheRuleConfiguration> getTypeClass() {
-        return ShardingCacheRuleConfiguration.class;
-    }
-    
-    @Override
-    public String getRuleTagName() {
-        return "SHARDING_CACHE";
-    }
-    
-    @Override
-    public int getOrder() {
-        return ShardingOrder.ORDER + 1;
-    }
-}
diff --git 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
 
b/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
deleted file mode 100644
index 567ac2e893b..00000000000
--- 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.sharding.cache.route.CachedShardingSQLRouter
diff --git 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
 
b/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
deleted file mode 100644
index e90e2b61a25..00000000000
--- 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.sharding.cache.rule.builder.ShardingCacheRuleBuilder
diff --git 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
 
b/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
deleted file mode 100644
index ec866c01061..00000000000
--- 
a/features/sharding/plugin/cache/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.sharding.cache.yaml.swapper.YamlShardingCacheRuleConfigurationSwapper
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
 
b/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
deleted file mode 100644
index e0925719535..00000000000
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/route/CachedShardingSQLRouterTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cache.route;
-
-import org.apache.shardingsphere.infra.datanode.DataNode;
-import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
-import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.infra.route.context.RouteMapper;
-import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import org.apache.shardingsphere.infra.session.query.QueryContext;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableCheckResult;
-import 
org.apache.shardingsphere.sharding.cache.checker.ShardingRouteCacheableChecker;
-import org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCache;
-import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheKey;
-import 
org.apache.shardingsphere.sharding.cache.route.cache.ShardingRouteCacheValue;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
-import org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.MockedConstruction;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.mockConstruction;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(MockitoExtension.class)
-class CachedShardingSQLRouterTest {
-    
-    @Mock
-    private ShardingCacheRule shardingCacheRule;
-    
-    @Test
-    void assertCreateRouteContextWithSQLExceedMaxAllowedLength() {
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(1, null));
-        QueryContext queryContext = new QueryContext(null, "select 1", 
Collections.emptyList());
-        RouteContext actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCacheRule, null, null);
-        assertRouteContextIsEmpty(actual);
-    }
-    
-    @Test
-    void assertCreateRouteContextWithNotCacheableQuery() {
-        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?), (?)", Collections.emptyList());
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(100, null));
-        
when(shardingCacheRule.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
-        when(shardingCacheRule.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(false, 
Collections.emptyList()));
-        RouteContext actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCacheRule, null, null);
-        assertRouteContextIsEmpty(actual);
-    }
-    
-    @Test
-    void assertCreateRouteContextWithUnmatchedActualParameterSize() {
-        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Collections.singletonList(0));
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(100, null));
-        
when(shardingCacheRule.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
-        when(shardingCacheRule.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
-        RouteContext actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCacheRule, null, null);
-        assertRouteContextIsEmpty(actual);
-    }
-    
-    private void assertRouteContextIsEmpty(final RouteContext actual) {
-        assertTrue(actual.getRouteUnits().isEmpty());
-        assertTrue(actual.getOriginalDataNodes().isEmpty());
-        assertTrue(actual.getRouteStageContexts().isEmpty());
-    }
-    
-    @Test
-    void assertCreateRouteContextWithCacheableQueryButCacheMissed() {
-        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Arrays.asList(0, 1));
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(100, null));
-        
when(shardingCacheRule.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
-        when(shardingCacheRule.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
-        
when(shardingCacheRule.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
-        RouteContext expected = new RouteContext();
-        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
-        
when(shardingCacheRule.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.empty());
-        RouteContext actual;
-        ShardingSphereRuleMetaData globalRuleMetaData = 
mock(ShardingSphereRuleMetaData.class);
-        try (
-                MockedConstruction<ShardingSQLRouter> ignored = 
mockConstruction(ShardingSQLRouter.class,
-                        (mock, context) -> when(mock.createRouteContext(
-                                queryContext, globalRuleMetaData, null, 
shardingCacheRule.getShardingRule(), null, null)).thenReturn(expected))) {
-            actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, globalRuleMetaData, 
null, shardingCacheRule, null, null);
-        }
-        assertThat(actual, is(expected));
-        
verify(shardingCacheRule.getRouteCache()).put(any(ShardingRouteCacheKey.class), 
any(ShardingRouteCacheValue.class));
-    }
-    
-    @Test
-    void assertCreateRouteContextWithCacheHit() {
-        QueryContext queryContext = new QueryContext(null, "insert into t 
values (?, ?)", Arrays.asList(0, 1));
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(100, null));
-        
when(shardingCacheRule.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
-        when(shardingCacheRule.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.singletonList(1)));
-        
when(shardingCacheRule.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
-        RouteContext expected = new RouteContext();
-        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Collections.singletonList(new RouteMapper("t", "t"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t")));
-        
when(shardingCacheRule.getRouteCache().get(any(ShardingRouteCacheKey.class))).thenReturn(Optional.of(new
 ShardingRouteCacheValue(expected)));
-        RouteContext actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, 
mock(ShardingSphereRuleMetaData.class), null, shardingCacheRule, null, null);
-        assertThat(actual, not(expected));
-        assertThat(actual.getOriginalDataNodes(), 
is(expected.getOriginalDataNodes()));
-        assertThat(actual.getRouteUnits(), is(expected.getRouteUnits()));
-    }
-    
-    @Test
-    void assertCreateRouteContextWithQueryRoutedToMultiDataNodes() {
-        QueryContext queryContext = new QueryContext(null, "select * from t", 
Collections.emptyList());
-        when(shardingCacheRule.getConfiguration()).thenReturn(new 
ShardingCacheRuleConfiguration(100, null));
-        
when(shardingCacheRule.getRouteCacheableChecker()).thenReturn(mock(ShardingRouteCacheableChecker.class));
-        when(shardingCacheRule.getRouteCacheableChecker().check(null, 
queryContext)).thenReturn(new ShardingRouteCacheableCheckResult(true, 
Collections.emptyList()));
-        
when(shardingCacheRule.getRouteCache()).thenReturn(mock(ShardingRouteCache.class));
-        RouteContext expected = new RouteContext();
-        expected.getRouteUnits().add(new RouteUnit(new RouteMapper("ds_0", 
"ds_0"), Arrays.asList(new RouteMapper("t", "t_0"), new RouteMapper("t", 
"t_1"))));
-        expected.getOriginalDataNodes().add(Collections.singletonList(new 
DataNode("ds_0", "t_0")));
-        ShardingSphereRuleMetaData globalRuleMetaData = 
mock(ShardingSphereRuleMetaData.class);
-        RouteContext actual;
-        try (
-                MockedConstruction<ShardingSQLRouter> ignored = 
mockConstruction(ShardingSQLRouter.class,
-                        (mock, context) -> 
when(mock.createRouteContext(queryContext, globalRuleMetaData, null, 
shardingCacheRule.getShardingRule(), null, null)).thenReturn(expected))) {
-            actual = new 
CachedShardingSQLRouter().createRouteContext(queryContext, globalRuleMetaData, 
null, shardingCacheRule, null, null);
-        }
-        assertThat(actual, is(expected));
-        verify(shardingCacheRule.getRouteCache(), 
never()).put(any(ShardingRouteCacheKey.class), 
any(ShardingRouteCacheValue.class));
-    }
-    
-    @Test
-    void assertDecorateRouteContext() {
-        RouteContext routeContext = mock(RouteContext.class);
-        new CachedShardingSQLRouter().decorateRouteContext(routeContext, null, 
null, null, null, null);
-        verifyNoInteractions(routeContext);
-    }
-    
-    @Test
-    void assertGetOrder() {
-        assertThat(new CachedShardingSQLRouter().getOrder(), is(-11));
-    }
-    
-    @Test
-    void assertGetTypeClass() {
-        assertThat(new CachedShardingSQLRouter().getTypeClass(), 
is(ShardingCacheRule.class));
-    }
-}
diff --git 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilderTest.java
 
b/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilderTest.java
deleted file mode 100644
index 6a533a92060..00000000000
--- 
a/features/sharding/plugin/cache/src/test/java/org/apache/shardingsphere/sharding/cache/rule/builder/ShardingCacheRuleBuilderTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cache.rule.builder;
-
-import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
-import org.apache.shardingsphere.sharding.cache.api.ShardingCacheOptions;
-import 
org.apache.shardingsphere.sharding.cache.api.ShardingCacheRuleConfiguration;
-import org.apache.shardingsphere.sharding.cache.rule.ShardingCacheRule;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.timeservice.core.rule.TimeServiceRule;
-import org.hamcrest.CoreMatchers;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.Mockito.mock;
-
-class ShardingCacheRuleBuilderTest {
-    
-    @Test
-    void assertBuildShardingCacheRule() {
-        ShardingRule expectedShardingRule = mock(ShardingRule.class);
-        TimeServiceRule expectedTimeServiceRule = mock(TimeServiceRule.class);
-        ShardingCacheRuleConfiguration expectedConfig = new 
ShardingCacheRuleConfiguration(100, new ShardingCacheOptions(true, 1, 1));
-        DatabaseRule actual = new 
ShardingCacheRuleBuilder().build(expectedConfig, "", Collections.emptyMap(), 
Arrays.asList(expectedShardingRule, expectedTimeServiceRule), null);
-        assertThat(actual, instanceOf(ShardingCacheRule.class));
-        ShardingCacheRule actualShardingCacheRule = (ShardingCacheRule) actual;
-        assertThat(actualShardingCacheRule.getConfiguration(), 
is(expectedConfig));
-        assertThat(actualShardingCacheRule.getShardingRule(), 
is(expectedShardingRule));
-    }
-    
-    @Test
-    void assertBuildShardingCacheRuleWithoutShardingRule() {
-        assertThrows(IllegalStateException.class, () -> new 
ShardingCacheRuleBuilder().build(null, "", Collections.emptyMap(), 
Collections.emptyList(), null));
-    }
-    
-    @Test
-    void assertGetOrder() {
-        assertThat(new ShardingCacheRuleBuilder().getOrder(), is(-9));
-    }
-    
-    @Test
-    void assertGetTypeClass() {
-        assertThat(new ShardingCacheRuleBuilder().getTypeClass(), 
CoreMatchers.<Class<ShardingCacheRuleConfiguration>>is(ShardingCacheRuleConfiguration.class));
-    }
-}
diff --git a/features/sharding/plugin/pom.xml b/features/sharding/plugin/pom.xml
index 393bb783f0f..76429cd459d 100644
--- a/features/sharding/plugin/pom.xml
+++ b/features/sharding/plugin/pom.xml
@@ -31,6 +31,5 @@
     <modules>
         <module>cosid</module>
         <module>nanoid</module>
-        <module>cache</module>
     </modules>
 </project>
diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml
index a425af5d803..3743336fbb8 100644
--- a/jdbc/core/pom.xml
+++ b/jdbc/core/pom.xml
@@ -125,11 +125,6 @@
             <artifactId>shardingsphere-sharding-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-sharding-cache</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-readwrite-splitting-core</artifactId>
diff --git a/proxy/bootstrap/pom.xml b/proxy/bootstrap/pom.xml
index d42ba005dd0..180efa7cc36 100644
--- a/proxy/bootstrap/pom.xml
+++ b/proxy/bootstrap/pom.xml
@@ -98,11 +98,6 @@
             <artifactId>shardingsphere-jdbc-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-sharding-cache</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>

Reply via email to