From cde5eca70b57002d8f354e92edbaad1be2b6051c Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 17 Dec 2024 23:32:04 -0500 Subject: [PATCH] Refactors ore gen cache entries to expire after 30 seconds (#2580) --- .../gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java index 813b7e3c16..bdae89af54 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import javax.annotation.ParametersAreNonnullByDefault; @@ -44,16 +45,19 @@ public class OreGenCache { private final Cache> veinMetadataByOrigin = CacheBuilder.newBuilder() .maximumSize(veinMetadataCacheSize) + .expireAfterAccess(30, TimeUnit.SECONDS) .softValues() .build(); private final Cache> generatedVeinsByOrigin = CacheBuilder.newBuilder() .maximumSize(oreGenerationCacheSize) + .expireAfterAccess(30, TimeUnit.SECONDS) .softValues() .build(); private final Cache> indicatorsByOrigin = CacheBuilder.newBuilder() .maximumSize(oreIndicatorCacheSize) + .expireAfterAccess(30, TimeUnit.SECONDS) .softValues() .build();