diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java index d12e18b71..a9c59d680 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/pages/DebugPage.java @@ -23,6 +23,7 @@ import com.djrapitops.plan.delivery.formatting.Formatters; import com.djrapitops.plan.delivery.rendering.html.Html; import com.djrapitops.plan.delivery.rendering.html.icon.Icon; import com.djrapitops.plan.delivery.rendering.html.structure.TabsElement; +import com.djrapitops.plan.delivery.webserver.cache.JSONCache; import com.djrapitops.plan.gathering.cache.SessionCache; import com.djrapitops.plan.gathering.domain.Session; import com.djrapitops.plan.identification.ServerInfo; @@ -106,12 +107,13 @@ public class DebugPage implements Page { private String createCacheContent() { StringBuilder content = new StringBuilder(); - appendResponseCache(content); + appendResourceCache(content); + appendJSONCache(content); appendSessionCache(content); return content.toString(); } - private void appendResponseCache(StringBuilder content) { + private void appendResourceCache(StringBuilder content) { try { content.append("
### Cached Resources (from File or Jar):

"); List cacheKeys = ResourceCache.getCachedResourceNames(); @@ -127,6 +129,22 @@ public class DebugPage implements Page { } } + private void appendJSONCache(StringBuilder content) { + try { + content.append("
### Cached JSON:

"); + List cacheKeys = JSONCache.getCachedIDs(); + if (cacheKeys.isEmpty()) { + content.append("Empty"); + } + for (String cacheKey : cacheKeys) { + content.append("- ").append(cacheKey).append("
"); + } + content.append("
"); + } catch (Exception e) { + errorHandler.log(L.WARN, this.getClass(), e); + } + } + private void appendSessionCache(StringBuilder content) { try { content.append("
### Session Cache:

"); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/JSONCache.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/JSONCache.java index 39fa80b29..5f25b47aa 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/JSONCache.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/JSONCache.java @@ -22,9 +22,7 @@ import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; import org.apache.commons.lang3.StringUtils; -import java.util.Arrays; -import java.util.Set; -import java.util.UUID; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -109,4 +107,10 @@ public class JSONCache { public static void cleanUp() { cache.cleanUp(); } + + public static List getCachedIDs() { + List identifiers = new ArrayList<>(cache.asMap().keySet()); + Collections.sort(identifiers); + return identifiers; + } } \ No newline at end of file