aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorMaZderMind2015-04-01 21:03:51 +0200
committerMaZderMind2015-04-01 21:03:51 +0200
commitb468a665f5b642578f51fc4031ac36e6f359c680 (patch)
tree43d0f681bde41dad840e07aeb2c86177cd728753 /model
parent759184ba0519acfa7d695e44c2af6c2d2a27794e (diff)
Use URL as Part of the Cache-Key
Diffstat (limited to 'model')
-rw-r--r--model/Relive.php16
-rw-r--r--model/Schedule.php9
2 files changed, 20 insertions, 5 deletions
diff --git a/model/Relive.php b/model/Relive.php
index a76761c..3a8b15b 100644
--- a/model/Relive.php
+++ b/model/Relive.php
@@ -8,12 +8,17 @@ class Relive extends ModelBase
return $this->has('CONFERENCE.RELIVE_JSON');
}
+ public function getJsonUrl()
+ {
+ return $this->get('CONFERENCE.RELIVE_JSON');
+ }
+
public function getTalks()
{
if($talks_by_id = $this->getCached())
return $talks_by_id;
- $talks = file_get_contents($this->get('CONFERENCE.RELIVE_JSON'));
+ $talks = file_get_contents($this->getJsonUrl());
$talks = utf8_decode($talks);
$talks = (array)json_decode($talks, true);
@@ -64,7 +69,7 @@ class Relive extends ModelBase
if(!$this->isCacheEnabled())
return null;
- return apc_fetch('RELIVE.CACHE');
+ return apc_fetch($this->getCacheKey());
}
private function doCache($value)
@@ -74,7 +79,12 @@ class Relive extends ModelBase
if(!$this->isCacheEnabled())
return $value;
- apc_store('RELIVE.CACHE', $value, $this->getCacheDuration());
+ apc_store($this->getCacheKey(), $value, $this->getCacheDuration());
return $value;
}
+
+ private function getCacheKey()
+ {
+ return 'RELIVE.'.$this->getJsonUrl();
+ }
}
diff --git a/model/Schedule.php b/model/Schedule.php
index db93c4d..86fb111 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -232,7 +232,7 @@ class Schedule extends ModelBase
if(!$this->isCacheEnabled())
return null;
- return apc_fetch('SCHEDULE.CACHE');
+ return apc_fetch($this->getCacheKey());
}
private function doCache($value)
@@ -242,10 +242,15 @@ class Schedule extends ModelBase
if(!$this->isCacheEnabled())
return $value;
- apc_store('SCHEDULE.CACHE', $value, $this->getCacheDuration());
+ apc_store($this->getCacheKey(), $value, $this->getCacheDuration());
return $value;
}
+ private function getCacheKey()
+ {
+ return 'SCHEDULE.'.$this->getScheduleUrl();
+ }
+
private function getScheduleToRoomSlugMapping()
{
$mapping = array();