Запрос вашей помощи, у меня есть 5 функций, как указано ниже, и функции getServerStatus3, getServerChange4 и getServerPatch5 зависят от функций getLocation1 и getServerList2, в настоящее время мы выполняем эти функции, как показано ниже, поэтому, если вы заметите, что функция getLocation1 и getServerList вызывается несколько раз, вместо того, чтобы вызывать несколько раз, как мне вызвать эти две функции и сохранить результат в памяти и использовать сохраненный результат для выполнения функций getServerStatus3, getServerChange4 и getServerPatch5. Вся функция в классе «Сервер» выполняется каждый час.
Список функций
- function getLocation1 () {return $ location; }
- function getServerList2 () {return $ Servers; }
- function getServerStatus3 () {return $ Status; }
- function getServerChange4 () {return $ Change;}
- function getServerPatch5 () {return $ Patch;}
Выполнение
class Server {
function getServerStatus3 () {
**$location = $this->getLocation1();**
**$Server = $this->getServerList();**
foreach($Server as $s) { $Status[] = status($s); return $Status; }
}
function getServerChange4() {
**$location = $this->getLocation1();**
**$Server = $this->getServerList();**
foreach($Server as $s) { $Change[] = change($s); return $Change; }
}
function getServerPatch5() {
**$location = $this->getLocation1();**
**$Server = $this->getServerList();**
foreach($Server as $s) { $Patch[] = patch($s); return $Patch; }
}
}