Stop clearing chunk cache after 768 batched packets are cached. (#1320)

This commit is contained in:
xFlare 2017-08-31 16:14:18 -04:00 committed by Dylan K. Taylor
parent b9c4a65307
commit 9ea39ea3d7

View File

@ -836,21 +836,15 @@ class Level implements ChunkManager, Metadatable{
$this->server->batchPackets($target, $packets, false, false); $this->server->batchPackets($target, $packets, false, false);
} }
public function clearCache(bool $full = false){ public function clearCache(bool $force = false){
if($full){ if($force){
$this->chunkCache = []; $this->chunkCache = [];
$this->blockCache = []; $this->blockCache = [];
}else{ }else{
if(count($this->chunkCache) > 768){
$this->chunkCache = [];
}
if(count($this->blockCache) > 2048){ if(count($this->blockCache) > 2048){
$this->blockCache = []; $this->blockCache = [];
} }
} }
} }
public function clearChunkCache(int $chunkX, int $chunkZ){ public function clearChunkCache(int $chunkX, int $chunkZ){