diff --git a/plugin.xml b/plugin.xml
index de73740..2553bf6 100755
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,12 +3,13 @@
com.fr.solution.plugin.db.redis.v10
yes
- 7.3.2
+ 7.3.3
10.0
2020-01-20
richie
[2020-06-05]搜索key的时候可以选择不同的数据库。
[2020-04-26]修复插件被标记为需要付费的问题。
[2020-04-21]修复redis集群下的一个问题。
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
index b8b2eea..63e2c4e 100755
--- a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
+++ b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
@@ -80,17 +80,18 @@ public class RedisDatabaseConnection extends BaseConnection {
return ArrayKit.EMPTY_STRING_ARRAY;
} else {
Redis redis = createRedisClient();
- EmbedRedis embedRedis = redis.getClient();
- int len = ArrayKit.getLength(args);
- if (len > 1) {
- int dbIndex = Integer.parseInt(args[1]);
- embedRedis.select(dbIndex);
+ try {
+ EmbedRedis embedRedis = redis.getClient();
+ int len = ArrayKit.getLength(args);
+ if (len > 1) {
+ int dbIndex = Integer.parseInt(args[1]);
+ embedRedis.select(dbIndex);
+ }
+ Set keys = embedRedis.keys(args[0]);
+ return keys.toArray(new String[0]);
+ } finally {
+ redis.close();
}
-
- Set keys = embedRedis.keys(args[0]);
- String[] array = keys.toArray(new String[0]);
- redis.close();
- return array;
}
}
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
index 3ff402d..16d805f 100644
--- a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
+++ b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
@@ -38,13 +38,17 @@ public class RedisScriptTableDataModel extends BaseDataModel {
return;
}
Redis redis = mc.createRedisClient();
- redis.getClient().select(dbIndex);
- RedisClient redisClient = RedisClientSelector.select(redis, engineType);
- SimpleDataModel simple = redisClient.build(redis, script, rowCount);
- if (simple != null) {
- this.columnNames = simple.getColumnNames();
- this.data = simple.getData();
- this.rowCount = simple.getRowCount();
+ try {
+ redis.getClient().select(dbIndex);
+ RedisClient redisClient = RedisClientSelector.select(redis, engineType);
+ SimpleDataModel simple = redisClient.build(redis, script, rowCount);
+ if (simple != null) {
+ this.columnNames = simple.getColumnNames();
+ this.data = simple.getData();
+ this.rowCount = simple.getRowCount();
+ }
+ } finally {
+ redis.close();
}
}
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java b/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
index 5bc5c40..19719e6 100644
--- a/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
+++ b/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
@@ -28,9 +28,9 @@ public class RedisTableDataModel extends BaseDataModel {
return;
}
Redis redis = mc.createRedisClient();
- redis.getClient().select(dbIndex);
- LogKit.info("Connect to redis and select database:" + dbIndex);
try {
+ redis.getClient().select(dbIndex);
+ LogKit.info("Connect to redis and select database:" + dbIndex);
long start = System.currentTimeMillis();
DataWrapper