mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 14:44:21 +00:00
Use URL as Part of the Cache-Key
This commit is contained in:
parent
759184ba05
commit
b468a665f5
2 changed files with 20 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue