mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Removed outdated Cache
This commit is contained in:
parent
286c1ee880
commit
668ddeeb13
@ -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));
|
||||
}
|
||||
|
@ -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,15 +1932,6 @@ 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);
|
||||
@ -1954,7 +1940,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
$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();
|
||||
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
namespace pocketmine\utils;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class Cache{
|
||||
public static $cached = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user