From cbddca3d7ef394c048aaebd67ebf3d14f035e464 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 2 Sep 2015 17:03:16 +0200 Subject: remove impractical apcu cache --- config.php | 14 -------------- model/Relive.php | 43 +------------------------------------------ model/Schedule.php | 43 +------------------------------------------ 3 files changed, 2 insertions(+), 98 deletions(-) diff --git a/config.php b/config.php index 4aeb8cc..622cc1e 100644 --- a/config.php +++ b/config.php @@ -102,13 +102,6 @@ $GLOBALS['CONFIG']['CONFERENCE'] = array( * Wird diese Zeile auskommentiert, wird der Link nicht angezeigt */ 'RELIVE_JSON' => 'configs/index.json', - - /** - * APCU-Cache-Zeit in Sekunden - * Wird diese Zeile auskommentiert, werden die apc_*-Methoden nicht verwendet und - * das Relive-Json bei jedem Request von der Quelle geladen und geparst - */ - //'RELIVE_JSON_CACHE' => 30*60, ); /** @@ -499,13 +492,6 @@ $GLOBALS['CONFIG']['SCHEDULE'] = array( */ //'ROOMFILTER' => array('Saal 1', 'Saal 2', 'Saal G', 'Saal 6'), - /** - * APCU-Cache-Zeit in Sekunden - * Wird diese Zeile auskommentiert, werden die apc_*-Methoden nicht verwendet und - * der Fahrplan bei jedem Request von der Quelle geladen und geparst - */ - //'CACHE' => 30*60, - /** * Skalierung der Programm-Vorschau in Sekunden pro Pixel */ 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(); diff --git a/model/Schedule.php b/model/Schedule.php index 7ff66af..bce1719 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -42,9 +42,6 @@ class Schedule extends ModelBase public function getSchedule() { - if($schedule = $this->getCached()) - return $schedule; - // download schedule-xml try { @@ -193,7 +190,7 @@ class Schedule extends ModelBase } } - return $this->doCache($program); + return $program; } @@ -220,44 +217,6 @@ class Schedule extends ModelBase return $this->get('SCHEDULE.URL'); } - private function isCacheEnabled() - { - return $this->has('SCHEDULE.CACHE') && function_exists('apc_fetch') && function_exists('apc_store'); - } - - private function getCacheDuration() - { - return $this->get('SCHEDULE.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 'SCHEDULE.'.$this->getScheduleUrl(); - } - public function getScheduleToRoomSlugMapping() { $mapping = array(); -- cgit v1.2.3