mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-21 18:15:54 +01:00
26 lines
1.5 KiB
Diff
26 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
Date: Tue, 29 Mar 2016 08:22:55 +0300
|
|
Subject: [PATCH] Sanitise RegionFileCache and make configurable
|
|
|
|
RegionFileCache prior to this patch would close every single open region
|
|
file upon reaching a size of 256.
|
|
This patch modifies that behaviour so it closes the the least recently
|
|
used RegionFile.
|
|
The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
|
|
The maximum size of the RegionFileCache is also made configurable.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
index df099d4c7f101f50d40dae99b45c271b02712434..491035aaefff4ee96435ec5d3f9417e28eae0796 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
@@ -39,7 +39,7 @@ public final class RegionFileStorage implements AutoCloseable {
|
|
if (regionfile != null) {
|
|
return regionfile;
|
|
} else {
|
|
- if (this.regionCache.size() >= 256) {
|
|
+ if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable
|
|
((RegionFile) this.regionCache.removeLast()).close();
|
|
}
|
|
|