Add caching to service site list
This commit is contained in:
@@ -6,6 +6,8 @@ class StatusBoard_Service {
|
|||||||
protected $name;
|
protected $name;
|
||||||
protected $description;
|
protected $description;
|
||||||
|
|
||||||
|
protected $sites;
|
||||||
|
|
||||||
protected function __construct($id, $name, $description) {
|
protected function __construct($id, $name, $description) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
@@ -77,8 +79,12 @@ class StatusBoard_Service {
|
|||||||
$this->id = null;
|
$this->id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sites() {
|
public function sites($ignore_cache = false) {
|
||||||
return StatusBoard_Site::all_for_service($this);
|
if ($this->sites === null || $ignore_cache) {
|
||||||
|
$this->sites = StatusBoard_Site::all_for_service($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->sites;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function id() {
|
public function id() {
|
||||||
|
|||||||
Reference in New Issue
Block a user