mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
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.
This commit is contained in:
parent
c801c5439d
commit
db2502d732
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -32,8 +32,8 @@
|
||||
@@ -32,21 +32,22 @@
|
||||
this.info = storageKey;
|
||||
}
|
||||
|
||||
@ -11,7 +11,12 @@
|
||||
RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
|
||||
|
||||
if (regionfile != null) {
|
||||
@@ -45,8 +45,9 @@
|
||||
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();
|
||||
}
|
||||
|
||||
FileUtil.createDirectoriesSafe(this.folder);
|
||||
Path path = this.folder;
|
||||
|
Loading…
Reference in New Issue
Block a user