diff --git a/redis-template-tool/pom.xml b/redis-template-tool/pom.xml
index 9cf23b921..18b5f9505 100644
--- a/redis-template-tool/pom.xml
+++ b/redis-template-tool/pom.xml
@@ -5,7 +5,7 @@
com.netease.lowcode
redis-template-tool
- 1.0.0
+ 1.0.1
org.springframework.boot
spring-boot-starter-parent
@@ -40,7 +40,11 @@
junit
test
-
+
+
+ org.apache.commons
+ commons-pool2
+
diff --git a/redis-template-tool/src/main/java/com/netease/lib/redistemplatetool/util/RedisTool.java b/redis-template-tool/src/main/java/com/netease/lib/redistemplatetool/util/RedisTool.java
index 34d661a95..a2b0571e1 100644
--- a/redis-template-tool/src/main/java/com/netease/lib/redistemplatetool/util/RedisTool.java
+++ b/redis-template-tool/src/main/java/com/netease/lib/redistemplatetool/util/RedisTool.java
@@ -4,6 +4,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -15,6 +17,34 @@ public class RedisTool {
@Autowired
public RedisTemplate redisTemplate;
+ /**
+ * 是否存在key,返回true/false
+ *
+ * @param key
+ * @return
+ */
+ @NaslLogic
+ public Boolean hasKey(String key) {
+ if (StringUtils.isEmpty(key)) {
+ return false;
+ }
+ return redisTemplate.hasKey(key);
+ }
+
+ /**
+ * 批量删除key
+ *
+ * @param keys
+ * @return
+ */
+ @NaslLogic
+ public Long deleteKeys(List keys) {
+ if (CollectionUtils.isEmpty(keys)) {
+ return 0L;
+ }
+ return redisTemplate.delete(keys);
+ }
+
/**
* 设置 Redis 中指定 key 的过期时间
*