diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 387fec66e..921919050 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1575,14 +1575,8 @@ class Server{ if($this->logger instanceof MainLogger){ $this->logger->setLogDebug(\pocketmine\DEBUG > 1); } - define("ADVANCED_CACHE", $this->getProperty("settings.advanced-cache", false)); - if(ADVANCED_CACHE == true){ - $this->logger->info("Advanced cache enabled"); - } - Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 8); - - if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0){ + if(\pocketmine\DEBUG >= 0){ @cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion()); } @@ -1690,7 +1684,6 @@ class Server{ return; } - $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([Cache::class, "cleanup"]), $this->getProperty("ticks-per.cache-cleanup", 900), $this->getProperty("ticks-per.cache-cleanup", 900)); if($this->getAutoSave() and $this->getProperty("ticks-per.autosave", 6000) > 0){ $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doAutoSave"]), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000)); } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index cd48b94c5..df4425483 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1150,9 +1150,6 @@ class Level implements ChunkManager, Metadatable{ } $block->position($pos); $index = Level::chunkHash($pos->x >> 4, $pos->z >> 4); - if(ADVANCED_CACHE == true){ - Cache::remove("world:" . $this->getId() . ":" . $index); - } if($direct === true){ $this->sendBlocks($this->getUsingChunk($pos->x >> 4, $pos->z >> 4), [$block], UpdateBlockPacket::FLAG_ALL_PRIORITY); @@ -1847,9 +1844,7 @@ class Level implements ChunkManager, Metadatable{ $this->provider->setChunk($x, $z, $chunk); $this->chunks[$index] = $chunk; } - if(ADVANCED_CACHE == true){ - Cache::remove("world:" . $this->getId() . ":" . Level::chunkHash($x, $z)); - } + $chunk->setChanged(); } @@ -1937,23 +1932,13 @@ class Level implements ChunkManager, Metadatable{ continue; } Level::getXZ($index, $x, $z); - if(ADVANCED_CACHE == true and ($cache = Cache::get("world:" . $this->getId() . ":" . $index)) !== false){ - /** @var Player[] $players */ - foreach($players as $player){ - if($player->isConnected() and isset($player->usedChunks[$index])){ - $player->sendChunk($x, $z, $cache); - } - } - unset($this->chunkSendQueue[$index]); - }else{ - $this->chunkSendTasks[$index] = true; - $this->timings->syncChunkSendPrepareTimer->startTiming(); - $task = $this->provider->requestChunkTask($x, $z); - if($task instanceof AsyncTask){ - $this->server->getScheduler()->scheduleAsyncTask($task); - } - $this->timings->syncChunkSendPrepareTimer->stopTiming(); + $this->chunkSendTasks[$index] = true; + $this->timings->syncChunkSendPrepareTimer->startTiming(); + $task = $this->provider->requestChunkTask($x, $z); + if($task instanceof AsyncTask){ + $this->server->getScheduler()->scheduleAsyncTask($task); } + $this->timings->syncChunkSendPrepareTimer->stopTiming(); } $this->timings->syncChunkSendTimer->stopTiming(); @@ -1963,10 +1948,6 @@ class Level implements ChunkManager, Metadatable{ public function chunkRequestCallback($x, $z, $payload){ $index = Level::chunkHash($x, $z); if(isset($this->chunkSendTasks[$index])){ - - if(ADVANCED_CACHE == true){ - Cache::add("world:" . $this->getId() . ":" . $index, $payload, 60); - } foreach($this->chunkSendQueue[$index] as $player){ /** @var Player $player */ if($player->isConnected() and isset($player->usedChunks[$index])){ @@ -2147,7 +2128,6 @@ class Level implements ChunkManager, Metadatable{ unset($this->chunks[$index]); unset($this->usedChunks[$index]); unset($this->chunkTickList[$index]); - Cache::remove("world:" . $this->getId() . ":$index"); $this->timings->doChunkUnload->stopTiming(); diff --git a/src/pocketmine/utils/Cache.php b/src/pocketmine/utils/Cache.php index 2b4121cbf..1bea19e6e 100644 --- a/src/pocketmine/utils/Cache.php +++ b/src/pocketmine/utils/Cache.php @@ -21,7 +21,9 @@ namespace pocketmine\utils; - +/** + * @deprecated + */ class Cache{ public static $cached = [];