Skip to content

Commit

Permalink
Refactors ore gen cache entries to expire after 30 seconds (#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt authored Dec 18, 2024
1 parent e7ad5ba commit cde5eca
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,16 +45,19 @@ public class OreGenCache {

private final Cache<ChunkPos, List<GeneratedVeinMetadata>> veinMetadataByOrigin = CacheBuilder.newBuilder()
.maximumSize(veinMetadataCacheSize)
.expireAfterAccess(30, TimeUnit.SECONDS)
.softValues()
.build();

private final Cache<ChunkPos, List<GeneratedVein>> generatedVeinsByOrigin = CacheBuilder.newBuilder()
.maximumSize(oreGenerationCacheSize)
.expireAfterAccess(30, TimeUnit.SECONDS)
.softValues()
.build();

private final Cache<ChunkPos, List<GeneratedIndicators>> indicatorsByOrigin = CacheBuilder.newBuilder()
.maximumSize(oreIndicatorCacheSize)
.expireAfterAccess(30, TimeUnit.SECONDS)
.softValues()
.build();

Expand Down

0 comments on commit cde5eca

Please sign in to comment.