This commit is contained in:
YuTian 2024-07-22 16:52:41 +08:00
parent 99060abcbb
commit 29b252565f
3 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ import java.util.Map;
public class RedisCacheSyncTimer { public class RedisCacheSyncTimer {
private static final String LOCK_KEY = "sync_lock"; private static final String LOCK_KEY = "sync_lock";
private static final int LOCK_EXPIRE_SECONDS = 600; private static final int LOCK_EXPIRE_SECONDS = 300;
private final Map<Plugin, PluginInfo> pluginInfos = new HashMap<>(); private final Map<Plugin, PluginInfo> pluginInfos = new HashMap<>();
private BukkitTask task; private BukkitTask task;
@ -53,7 +53,7 @@ public class RedisCacheSyncTimer {
} }
if (data != null) { if (data != null) {
String finalData = data; String finalData = data;
synchronizer.sync(finalData); synchronizer.sync(k, finalData);
if (k2 == null) { if (k2 == null) {
jedis.del(k); jedis.del(k);
} else { } else {
@ -65,7 +65,7 @@ public class RedisCacheSyncTimer {
} }
} }
} }
}.runTaskTimerAsynchronously(AuLib.inst(), 0L, 10L * 20 * 60L); }.runTaskTimerAsynchronously(AuLib.inst(), 60L, 5 * 60 * 20L);
} }
public void registerSynchronizer(Plugin plugin, IJedisGetter jedisGetter, Pair<String, String> key, RedisCacheSynchronizer synchronizer) { public void registerSynchronizer(Plugin plugin, IJedisGetter jedisGetter, Pair<String, String> key, RedisCacheSynchronizer synchronizer) {

View File

@ -3,6 +3,6 @@ package com.io.yutian.aulib.redis;
@FunctionalInterface @FunctionalInterface
public interface RedisCacheSynchronizer { public interface RedisCacheSynchronizer {
void sync(String data); void sync(String key, String data);
} }

View File

@ -1,5 +1,5 @@
name: AuLib name: AuLib
main: com.io.yutian.aulib.AuLib main: com.io.yutian.aulib.AuLib
version: 2.4 version: 2.5
api-version: 1.18 api-version: 1.18
author: SuperYuTian author: SuperYuTian