RegionIO/internal/world
Master290 65a7445a78 LRU chunk eviction (bounded cache, default 1024 chunks / ~200MB)
The in-memory chunk+frame cache no longer grows unbounded as players
explore. An LRU policy (doubly-linked list + index map, O(1) per op)
evicts least-recently-used chunks when the cache exceeds MaxCachedChunks,
dropping both the chunk and its cached frame. Dirty chunks are skipped
until the autosave flushes them, so no edit is ever lost to eviction.

- world/cache.go: maxChunks field + order/index LRU bookkeeping; touch
  (move-to-front) on every chunkAt/Frame/SetBlock hit; evictIfNeeded on
  miss; NewCacheWithLimit constructor (0 = unbounded, backward-compat).
  Dirty chunks are bumped to MRU and left in place rather than doing
  region I/O under the cache mutex.
- server/server.go: Config.MaxCachedChunks (default 1024); New wires it
  into NewCacheWithLimit when a world dir is set.
- cmd/regionio/main.go: -maxcache flag.
- Tests: limit cap, LRU ordering (touched chunk survives), both-maps
  drop, dirty-keep, reload-on-access, and edits-survive-eviction+reload
  (end-to-end via the store).
2026-06-25 13:56:06 +03:00
..
testdata Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
bench_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
biome_3d_test.go 3D per-cell biomes (4x4x4) with surface/underground/cave layers 2026-06-24 01:04:01 +03:00
biome_bench_test.go 3D per-cell biomes (4x4x4) with surface/underground/cave layers 2026-06-24 01:04:01 +03:00
biome_lookup.go Biome-aware surface rules from the vanilla rule tree 2026-06-24 19:44:07 +03:00
biome_lookup_test.go 3D per-cell biomes (4x4x4) with surface/underground/cave layers 2026-06-24 01:04:01 +03:00
biome_parameters.json Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
blocks.json Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
cache.go LRU chunk eviction (bounded cache, default 1024 chunks / ~200MB) 2026-06-25 13:56:06 +03:00
cache_test.go LRU chunk eviction (bounded cache, default 1024 chunks / ~200MB) 2026-06-25 13:56:06 +03:00
chunk.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
compress.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
encode.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
encode_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
golden_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
item_blocks.json Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
items.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
light.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
regionfile.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
state_names.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
store.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
store_test.go Chunk persistence to Anvil .mca region files 2026-06-25 00:40:14 +03:00
surface_verify_test.go Biome-aware surface rules from the vanilla rule tree 2026-06-24 19:44:07 +03:00
terrain.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
terrain_bench_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
terrain_debug_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
vanilla.go Biome-aware surface rules from the vanilla rule tree 2026-06-24 19:44:07 +03:00
vanilla_bench_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00
vanilla_parity_test.go Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775) 2026-06-24 00:32:51 +03:00