aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-05-31 13:04:51 +0200
committerGitHub <noreply@github.com>2023-05-31 13:04:51 +0200
commite89d2e7de492c523a941cadf4747d428de6e7250 (patch)
tree064a0316f06c8ebf5a3425b9096458306dfa8f20 /src/main/kotlin
parentf4a9e4011b09be043ec086abd365d0e8c443bbec (diff)
downloadNotEnoughUpdates-e89d2e7de492c523a941cadf4747d428de6e7250.tar.gz
NotEnoughUpdates-e89d2e7de492c523a941cadf4747d428de6e7250.tar.bz2
NotEnoughUpdates-e89d2e7de492c523a941cadf4747d428de6e7250.zip
Fix Soopy Networth (#706)
* Fix Soopy Networth * Add api cache clear command
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt5
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt6
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index bc1a0c74..58da635e 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Custom
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager
import io.github.moulberry.notenoughupdates.miscgui.pricegraph.GuiPriceGraph
+import io.github.moulberry.notenoughupdates.util.ApiCache
import io.github.moulberry.notenoughupdates.util.PronounDB
import io.github.moulberry.notenoughupdates.util.SBInfo
import io.github.moulberry.notenoughupdates.util.TabListUtils
@@ -186,6 +187,10 @@ class DevTestCommand {
NotEnoughUpdates.INSTANCE.saveConfig()
reply("Config saved")
}.withHelp("Force sync the config to disk")
+ thenLiteralExecute("clearapicache") {
+ ApiCache.clear()
+ reply("Cleared API cache")
+ }.withHelp("Clear the API cache")
thenLiteralExecute("searchmode") {
NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = true
reply(AQUA.toString() + "I would never search")
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
index 59fc2dd5..f670346d 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
@@ -151,6 +151,12 @@ object ApiCache {
}
}
+ fun clear() {
+ synchronized(this) {
+ cachedRequests.clear()
+ }
+ }
+
private fun evictCache() {
synchronized(this) {
val it = cachedRequests.iterator()