Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master'

James 3 years ago
parent
commit
a121cbb5dc
1 changed files with 11 additions and 12 deletions
  1. 11 12
      src/main/java/com/jfinal/plugin/redis/Cache.java

+ 11 - 12
src/main/java/com/jfinal/plugin/redis/Cache.java

@@ -1493,21 +1493,20 @@ public class Cache {
 	 */
 	 */
 	public List<Object> tx(String watchKeys, F10<Transaction> tx) {
 	public List<Object> tx(String watchKeys, F10<Transaction> tx) {
 		Jedis jedis = getJedis();
 		Jedis jedis = getJedis();
-
 		boolean watched = false;
 		boolean watched = false;
-		// 多个 watchKey 使用逗号分隔
-		if (StrKit.notBlank(watchKeys)) {
-			String[] keys = watchKeys.split(",");
-			for (String k : keys) {
-			    if (StrKit.notBlank(k)) {
-			        jedis.watch(k.trim());
-			        watched = true;
-			    }
-			}
-		}
-
 		Transaction transaction = null;
 		Transaction transaction = null;
 		try {
 		try {
+			// 多个 watchKey 使用逗号分隔
+			if (StrKit.notBlank(watchKeys)) {
+				String[] keys = watchKeys.split(",");
+				for (String k : keys) {
+					if (StrKit.notBlank(k)) {
+						jedis.watch(k.trim());
+						watched = true;
+					}
+				}
+			}
+
 			transaction = jedis.multi();
 			transaction = jedis.multi();
 			tx.call(transaction);
 			tx.call(transaction);
 			return transaction.exec();
 			return transaction.exec();