diff options
author | MaZderMind | 2015-09-02 17:03:16 +0200 |
---|---|---|
committer | MaZderMind | 2015-09-02 17:03:16 +0200 |
commit | cbddca3d7ef394c048aaebd67ebf3d14f035e464 (patch) | |
tree | a2593f80f149dd730c6152a1ac3f94df81ca2f13 /model/Relive.php | |
parent | 77683e1d5aaf6954f1d5c10937333ea98983ef37 (diff) |
remove impractical apcu cache
Diffstat (limited to '')
-rw-r--r-- | model/Relive.php | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/model/Relive.php b/model/Relive.php index 912e492..671f1cb 100644 --- a/model/Relive.php +++ b/model/Relive.php @@ -15,9 +15,6 @@ class Relive extends ModelBase public function getTalks() { - if($talks_by_id = $this->getCached()) - return $talks_by_id; - $talks = file_get_contents($this->getJsonUrl()); $talks = (array)json_decode($talks, true); @@ -49,7 +46,7 @@ class Relive extends ModelBase $talks_by_id[$talk['id']] = $talk; } - return $this->doCache($talks_by_id); + return $talks_by_id; } public function getTalk($id) @@ -61,44 +58,6 @@ class Relive extends ModelBase return $talks[$id]; } - private function isCacheEnabled() - { - return $this->has('CONFERENCE.RELIVE_JSON_CACHE') && function_exists('apc_fetch') && function_exists('apc_store'); - } - - private function getCacheDuration() - { - return $this->get('CONFERENCE.RELIVE_JSON_CACHE', 60*10 /* 10 minutes */); - } - - private $localCache = null; - private function getCached() - { - if($this->localCache) - return $this->localCache; - - if(!$this->isCacheEnabled()) - return null; - - return apc_fetch($this->getCacheKey()); - } - - private function doCache($value) - { - $this->localCache = $value; - - if(!$this->isCacheEnabled()) - return $value; - - apc_store($this->getCacheKey(), $value, $this->getCacheDuration()); - return $value; - } - - private function getCacheKey() - { - return 'RELIVE.'.$this->getJsonUrl(); - } - private function getScheduleToRoomMapping() { $schedule = new Schedule(); |