summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--providers/Rss.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/providers/Rss.php b/providers/Rss.php
index 6fdae6c..9f64088 100644
--- a/providers/Rss.php
+++ b/providers/Rss.php
@@ -7,8 +7,6 @@ require_once('Item.php');
class Rss extends \Providers\Provider {
- protected $_cacheTimeout = '1 second';
-
private $_feedUrl;
private $_feedXml;
@@ -61,7 +59,17 @@ class Rss extends \Providers\Provider {
}
public function title() {
- return strval($this->_feedXml->title ?: $this->_feedXml->channel->title);
+ $cacheFile = sprintf($this->_getCachePath() . '.title', $this->_feed);
+ if (!file_exists($cacheFile)) {
+ $this->_fetchItems();
+ }
+ if ($this->_feedXml) {
+ $title = strval($this->_feedXml->title ?: $this->_feedXml->channel->title);
+ file_put_contents($cacheFile, $title);
+ return $title;
+ } else {
+ return file_get_contents($cacheFile);
+ }
}
}