Skip to content

Commit

Permalink
Added support for Navigation DSs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Dunn committed Dec 15, 2009
1 parent 6365c7a commit b72c6e4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
14 changes: 11 additions & 3 deletions README.markdown
@@ -1,7 +1,7 @@
# Cacheable Datasource
Version: 0.1
Version: 0.2
Author: [Nick Dunn](http://nick-dunn.co.uk)
Build Date: 07 December 2009
Build Date: 15 December 2009
Requirements: Symphony 2.0.6

Explorations from a forum discussion [Datasource Caching](http://symphony-cms.com/discuss/thread/32535/).
Expand Down Expand Up @@ -53,4 +53,12 @@ Caches expire when their timeouts are met. You can manually purge the cache by l
## Why are so many cache files created?
Cache files are never deleted, only overwritten when they have expired. It is normal to have many files generated for each data source since the filename is a hashed signature of all of its configuration properties and filters. This means that if you have pagination enabled, a cache file is generated for each page of results since each page creates a unique combination of filters.

It works this way to allow for very wide, rather than narrow, hierarchies. Say you have a site showcasing bands, 10,000 in total. Your Band page accepts an artist entry ID and filters the Bands section to show that single entry. For this wide sitemap, you would require each instance of the Band Profile datasource to be cached individually. Which it is :-)
It works this way to allow for very wide, rather than narrow, hierarchies. Say you have a site showcasing bands, 10,000 in total. Your Band page accepts an artist entry ID and filters the Bands section to show that single entry. For this wide sitemap, you would require each instance of the Band Profile datasource to be cached individually. Which it is :-)

## Changelog

* 0.2, 15 December 2009
* added support for Navigation DS (thanks [andrrr](http://symphony-cms.com/get-involved/member/andrrr/))

* 0.1, 07 December 2009
* initial release
4 changes: 2 additions & 2 deletions extension.driver.php
Expand Up @@ -4,8 +4,8 @@

public function about(){
return array('name' => 'Cacheable Datasource',
'version' => '0.1',
'release-date' => '2009-12-07',
'version' => '0.2',
'release-date' => '2009-12-15',
'author' => array('name' => 'Nick Dunn',
'website' => 'http://nick-dunn.co.uk'),
'description' => 'Create custom Data Sources that implement output caching');
Expand Down
8 changes: 6 additions & 2 deletions lib/class.cacheabledatasource.php
Expand Up @@ -76,7 +76,7 @@ private function grabResult(&$param_pool=array()) {
public function grab(&$param_pool=array()) {

// Check that this DS has a cache time set
if (isset($this->dsParamCACHE) && is_numeric($this->dsParamCACHE) && $this->dsParamCACHE > 0 && is_numeric($this->getSource())) {
if (isset($this->dsParamCACHE) && is_numeric($this->dsParamCACHE) && $this->dsParamCACHE > 0) {
$filename = null;
$file_age = 0;

Expand Down Expand Up @@ -144,7 +144,11 @@ public function grab_xml(&$param_pool){
$result = new XMLElement($this->dsParamROOTELEMENT);

try{
include(TOOLKIT . '/data-sources/datasource.section.php');
if ($this->getSource() == 'navigation') {
include(TOOLKIT . '/data-sources/datasource.navigation.php');
} else {
include(TOOLKIT . '/data-sources/datasource.section.php');
}
}
catch(Exception $e){
$result->appendChild(new XMLElement('error', $e->getMessage()));
Expand Down

0 comments on commit b72c6e4

Please sign in to comment.