-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding in Classes\GenerateRSS class and routes/controllers for the RS…
…S content
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace BlogModule\Classes; | ||
|
||
class GenerateRSS { | ||
|
||
protected $cache = null; | ||
protected $defaultTTL = 43200; // (86400 / 2) | ||
protected $cacheKey = 'blog_rss_generate'; | ||
protected $blogPostStorage = null; | ||
|
||
public function __construct($cache, $blogPostStorage) | ||
{ | ||
$this->cache = $cache; | ||
$this->blogPostStorage = $blogPostStorage; | ||
} | ||
|
||
/** | ||
* Generate the RSS data | ||
* | ||
* @return array | ||
*/ | ||
public function getRSSContent() | ||
{ | ||
|
||
if ($this->cache->contains($this->cacheKey)) { | ||
$rssData = $this->cache->fetch($this->cacheKey); | ||
} else { | ||
|
||
$rssData = array(); | ||
|
||
/* @todo - Generate RSS content */ | ||
|
||
$this->cache->save($this->cacheKey, $rssData, $this->defaultTTL); | ||
} | ||
|
||
return $rssData; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters