diff --git a/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java b/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java index d1e2c06..28e2b11 100644 --- a/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java +++ b/src/main/java/me/braydon/mc/model/cache/CachedMinecraftServer.java @@ -690,9 +690,9 @@ import java.io.Serializable; @RedisHash(value = "server", timeToLive = 60L) // 1 minute (in seconds) public final class CachedMinecraftServer implements Serializable { /** - * The hostname of the cached server. + * The id of this cached server. */ - @Id @NonNull private transient final String hostname; + @Id @NonNull private transient final String id; /** * The cached server. diff --git a/src/main/java/me/braydon/mc/service/MojangService.java b/src/main/java/me/braydon/mc/service/MojangService.java index d89bdc5..9f3e4e0 100644 --- a/src/main/java/me/braydon/mc/service/MojangService.java +++ b/src/main/java/me/braydon/mc/service/MojangService.java @@ -1007,7 +1007,7 @@ public final class MojangService { String lookupHostname = hostname; // The hostname used to lookup the server // Check the cache for the server - Optional cached = minecraftServerCache.findById(hostname); + Optional cached = minecraftServerCache.findById(platform.name() + "-" + hostname); if (cached.isPresent()) { // Respond with the cache if present log.info("Found server in cache: {}", hostname); return cached.get(); @@ -1021,7 +1021,7 @@ public final class MojangService { } // Build our server model, cache it, and then return it CachedMinecraftServer minecraftServer = new CachedMinecraftServer( - lookupHostname, + platform.name() + "-" + lookupHostname, platform.getPinger().ping(hostname, port), System.currentTimeMillis() );