diff --git a/src/main/java/com/io/yutian/aulib/redis/RedisCacheSyncTimer.java b/src/main/java/com/io/yutian/aulib/redis/RedisCacheSyncTimer.java index 1acd169..9f87290 100644 --- a/src/main/java/com/io/yutian/aulib/redis/RedisCacheSyncTimer.java +++ b/src/main/java/com/io/yutian/aulib/redis/RedisCacheSyncTimer.java @@ -1,7 +1,7 @@ package com.io.yutian.aulib.redis; import com.io.yutian.aulib.AuLib; -import it.unimi.dsi.fastutil.Pair; +import com.io.yutian.aulib.util.Pair; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -44,19 +44,21 @@ public class RedisCacheSyncTimer { RedisCacheSynchronizer synchronizer = entry1.getValue(); String k1 = key.first(); String k2 = key.second(); - String data = null; - if (k2 == null) { - data = jedis.get(k1); - } else { - data = jedis.hget(k1, k2); - } - if (data != null) { - String finalData = data; - synchronizer.sync(finalData); + for (String k : jedis.keys(k1+":*")) { + String data = null; if (k2 == null) { - jedis.del(k1); + data = jedis.get(k); } else { - jedis.hdel(k1, k2); + data = jedis.hget(k, k2); + } + if (data != null) { + String finalData = data; + synchronizer.sync(finalData); + if (k2 == null) { + jedis.del(k); + } else { + jedis.hdel(k, k2); + } } } } diff --git a/src/main/java/com/io/yutian/aulib/util/Pair.java b/src/main/java/com/io/yutian/aulib/util/Pair.java new file mode 100644 index 0000000..3b808b3 --- /dev/null +++ b/src/main/java/com/io/yutian/aulib/util/Pair.java @@ -0,0 +1,42 @@ +package com.io.yutian.aulib.util; + +public class Pair { + + protected final L left; + protected final R right; + + public Pair(L left, R right) { + this.left = left; + this.right = right; + } + + public static Pair of(K left, V right) { + return new Pair(left, right); + } + + public L left() { + return this.left; + } + + public R right() { + return this.right; + } + + public L first() { + return this.left(); + } + + public R second() { + return this.right(); + } + + public L key() { + return this.left(); + } + + public R value() { + return this.right(); + } + + +} \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8623261..5bfdb67 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: AuLib main: com.io.yutian.aulib.AuLib -version: 2.3 +version: 2.4 api-version: 1.18 author: SuperYuTian \ No newline at end of file