ChunkCache
Implements ChunkListener
This class is used by the current MCPE protocol system to store cached chunk packets for fast resending.
Methods
calculateCacheSize()
php
public function calculateCacheSize() : intReturns the number of bytes occupied by the cache data in this cache. This does not include the size of any promises referenced by the cache.
getHitPercentage()
php
public function getHitPercentage() : floatReturns the percentage of requests to the cache which resulted in a cache hit.
getInstance()
php
public static function getInstance(\pocketmine\world\World $world, \pocketmine\network\mcpe\compression\Compressor $compressor) : selfFetches the ChunkCache instance for the given world. This lazily creates cache systems as needed.
onBlockChanged()
php
public function onBlockChanged(\pocketmine\math\Vector3 $block) : voidonChunkChanged()
php
public function onChunkChanged(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : voidonChunkUnloaded()
php
public function onChunkUnloaded(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : voidpruneCaches()
php
public static function pruneCaches() : voidrequest()
php
public function request(int $chunkX, int $chunkZ) : \pocketmine\network\mcpe\compression\CompressBatchPromise|stringRequests asynchronous preparation of the chunk at the given coordinates.
