org.springblade
diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CacheUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CacheUtil.java
index 88ac33a..e557fb2 100644
--- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CacheUtil.java
+++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CacheUtil.java
@@ -26,6 +26,7 @@ import java.util.concurrent.Callable;
*
* @author Chill
*/
+@Deprecated
public class CacheUtil {
public static final String SYS_CACHE = "blade:sys";
diff --git a/blade-starter-cache/pom.xml b/blade-starter-cache/pom.xml
new file mode 100644
index 0000000..f9b3995
--- /dev/null
+++ b/blade-starter-cache/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ org.springblade
+ blade-tool
+ ${revision}
+
+
+ blade-starter-cache
+ ${project.artifactId}
+ jar
+
+
+ org.springblade.blade.starter.cache
+
+
+
+
+
+ org.springblade
+ blade-core-tool
+
+
+
diff --git a/blade-starter-cache/src/main/java/org/springblade/core/cache/config/CacheConfiguration.java b/blade-starter-cache/src/main/java/org/springblade/core/cache/config/CacheConfiguration.java
new file mode 100644
index 0000000..8f0ab90
--- /dev/null
+++ b/blade-starter-cache/src/main/java/org/springblade/core/cache/config/CacheConfiguration.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * 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.springblade.core.cache.config;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.cache.annotation.EnableCaching;
+
+/**
+ * Cache配置类
+ *
+ * @author Chill
+ */
+@EnableCaching
+@AutoConfiguration
+public class CacheConfiguration {
+}
diff --git a/blade-starter-cache/src/main/java/org/springblade/core/cache/constant/CacheConstant.java b/blade-starter-cache/src/main/java/org/springblade/core/cache/constant/CacheConstant.java
new file mode 100644
index 0000000..e9829f2
--- /dev/null
+++ b/blade-starter-cache/src/main/java/org/springblade/core/cache/constant/CacheConstant.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * 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.springblade.core.cache.constant;
+
+/**
+ * 缓存名
+ *
+ * @author Chill
+ */
+public interface CacheConstant {
+
+ String BIZ_CACHE = "blade:biz";
+
+ String MENU_CACHE = "blade:menu";
+
+ String USER_CACHE = "blade:user";
+
+ String DICT_CACHE = "blade:dict";
+
+ String FLOW_CACHE = "blade:flow";
+
+ String SYS_CACHE = "blade:sys";
+
+ String RESOURCE_CACHE = "blade:resource";
+
+ String PARAM_CACHE = "blade:param";
+
+ String DEFAULT_CACHE = "default:cache";
+
+ String RETRY_LIMIT_CACHE = "retry:limit:cache";
+
+ String HALF_HOUR = "half:hour";
+
+ String HOUR = "hour";
+
+ String ONE_DAY = "one:day";
+
+}
diff --git a/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java b/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java
new file mode 100644
index 0000000..16390b1
--- /dev/null
+++ b/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java
@@ -0,0 +1,152 @@
+/**
+ * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * 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.springblade.core.cache.utils;
+
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.lang.Nullable;
+
+import java.util.concurrent.Callable;
+
+/**
+ * 缓存工具类
+ *
+ * @author Chill
+ */
+public class CacheUtil {
+
+ public static final String SYS_CACHE = "blade:sys";
+
+ private static CacheManager cacheManager;
+
+ /**
+ * 获取缓存工具
+ *
+ * @return CacheManager
+ */
+ private static CacheManager getCacheManager() {
+ if (cacheManager == null) {
+ cacheManager = SpringUtil.getBean(CacheManager.class);
+ }
+ return cacheManager;
+ }
+
+ /**
+ * 获取缓存对象
+ *
+ * @param cacheName 缓存名
+ * @return Cache
+ */
+ public static Cache getCache(String cacheName) {
+ return getCacheManager().getCache(cacheName);
+ }
+
+ /**
+ * 获取缓存
+ *
+ * @param cacheName 缓存名
+ * @param keyPrefix 缓存键前缀
+ * @param key 缓存键值
+ * @return Cache
+ */
+ @Nullable
+ public static Object get(String cacheName, String keyPrefix, Object key) {
+ if (Func.hasEmpty(cacheName, keyPrefix, key)) {
+ return null;
+ }
+ Cache.ValueWrapper wrapper = getCache(cacheName).get(keyPrefix.concat(String.valueOf(key)));
+ return wrapper == null ? null : wrapper.get();
+ }
+
+ /**
+ * 获取缓存
+ *
+ * @param cacheName 缓存名
+ * @param keyPrefix 缓存键前缀
+ * @param key 缓存键值
+ * @param type 转换类型
+ * @param 类型
+ * @return Cache
+ */
+ @Nullable
+ public static T get(String cacheName, String keyPrefix, Object key, @Nullable Class type) {
+ if (Func.hasEmpty(cacheName, keyPrefix, key)) {
+ return null;
+ }
+ return getCache(cacheName).get(keyPrefix.concat(String.valueOf(key)), type);
+ }
+
+ /**
+ * 获取缓存
+ *
+ * @param cacheName 缓存名
+ * @param keyPrefix 缓存键前缀
+ * @param key 缓存键值
+ * @param valueLoader 重载对象
+ * @param 类型
+ * @return Cache
+ */
+ @Nullable
+ public static T get(String cacheName, String keyPrefix, Object key, Callable valueLoader) {
+ if (Func.hasEmpty(cacheName, keyPrefix, key)) {
+ return null;
+ }
+ String cacheKey = keyPrefix.concat(String.valueOf(key));
+ return getCache(cacheName).get(cacheKey, valueLoader);
+ }
+
+ /**
+ * 设置缓存
+ *
+ * @param cacheName 缓存名
+ * @param keyPrefix 缓存键前缀
+ * @param key 缓存键值
+ * @param value 缓存值
+ */
+ public static void put(String cacheName, String keyPrefix, Object key, @Nullable Object value) {
+ getCache(cacheName).put(keyPrefix.concat(String.valueOf(key)), value);
+ }
+
+ /**
+ * 清除缓存
+ *
+ * @param cacheName 缓存名
+ * @param keyPrefix 缓存键前缀
+ * @param key 缓存键值
+ */
+ public static void evict(String cacheName, String keyPrefix, Object key) {
+ if (Func.hasEmpty(cacheName, keyPrefix, key)) {
+ return;
+ }
+ getCache(cacheName).evict(keyPrefix.concat(String.valueOf(key)));
+ }
+
+ /**
+ * 清空缓存
+ *
+ * @param cacheName 缓存名
+ */
+ public static void clear(String cacheName) {
+ if (Func.isEmpty(cacheName)) {
+ return;
+ }
+ getCache(cacheName).clear();
+ }
+
+}
+
diff --git a/blade-starter-tenant/pom.xml b/blade-starter-tenant/pom.xml
new file mode 100644
index 0000000..0eb086e
--- /dev/null
+++ b/blade-starter-tenant/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+ org.springblade
+ blade-tool
+ ${revision}
+
+
+ blade-starter-tenant
+ ${project.artifactId}
+ jar
+
+
+ org.springblade.blade.starter.tenant
+
+
+
+
+
+ org.springblade
+ blade-core-launch
+
+
+ org.springblade
+ blade-core-tool
+
+
+ org.springblade
+ blade-starter-mybatis
+
+
+
+
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantHandler.java
similarity index 95%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantHandler.java
index 77a0ea6..7a2a744 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantHandler.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantHandler.java
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;
-import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantId.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantId.java
similarity index 95%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantId.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantId.java
index 19a2588..548573e 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantId.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantId.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import org.springblade.core.tool.utils.RandomType;
import org.springblade.core.tool.utils.StringUtil;
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantInterceptor.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantInterceptor.java
similarity index 96%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantInterceptor.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantInterceptor.java
index abbaba3..fcd81fd 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantInterceptor.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantInterceptor.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantProperties.java
similarity index 97%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantProperties.java
index 8015893..7350ced 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/BladeTenantProperties.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/BladeTenantProperties.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import lombok.Getter;
import lombok.Setter;
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConfiguration.java
similarity index 98%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConfiguration.java
index 2478b54..a5c8149 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConfiguration.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConfiguration.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConstant.java
similarity index 94%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConstant.java
index 6b0895b..3c269d8 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantConstant.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantConstant.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
/**
* 租户常量.
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantId.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantId.java
similarity index 94%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantId.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantId.java
index f871bd9..8ae8dac 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantId.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantId.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
/**
* 租户id生成器
diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantIdUtil.java b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantIdUtil.java
similarity index 97%
rename from blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantIdUtil.java
rename to blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantIdUtil.java
index e7739f0..c5f6246 100644
--- a/blade-core-boot/src/main/java/org/springblade/core/boot/tenant/TenantIdUtil.java
+++ b/blade-starter-tenant/src/main/java/org/springblade/core/tenant/TenantIdUtil.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springblade.core.boot.tenant;
+package org.springblade.core.tenant;
import lombok.experimental.UtilityClass;
import org.springblade.core.secure.utils.SecureUtil;
diff --git a/pom.xml b/pom.xml
index 734394e..7982405 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,8 @@
blade-starter-social
blade-starter-swagger
blade-starter-transaction
+ blade-starter-cache
+ blade-starter-tenant
@@ -195,6 +197,11 @@
blade-starter-oss
${revision}
+