forked from blallo/rss-bridge
[BridgeAbstract] Return cached infos when using cached items
Re-requesting the same feed in normal mode (not debug mode) returns the cached version. The name and URI of the feed however was not returned. This adds checks to getName() and getURI() in order to return the cached infos when using the cached version. Notice: For this to work correctly all bridges must call to parent::getName() and parent::getURI() respectively if the queriedContext is not defined. Example: switch($this->queriedContext){ case 'My context': // do your stuff here! break; default: parent::getName(); }
This commit is contained in:
parent
6eadc6ca6f
commit
28331e7cd6
1 changed files with 10 additions and 0 deletions
|
@ -237,6 +237,11 @@ abstract class BridgeAbstract implements BridgeInterface {
|
|||
}
|
||||
|
||||
public function getName(){
|
||||
// Return cached name when bridge is using cached data
|
||||
if(isset($this->extraInfos)){
|
||||
return $this->extraInfos['name'];
|
||||
}
|
||||
|
||||
return static::NAME;
|
||||
}
|
||||
|
||||
|
@ -245,6 +250,11 @@ abstract class BridgeAbstract implements BridgeInterface {
|
|||
}
|
||||
|
||||
public function getURI(){
|
||||
// Return cached uri when bridge is using cached data
|
||||
if(isset($this->extraInfos)){
|
||||
return $this->extraInfos['uri'];
|
||||
}
|
||||
|
||||
return static::URI;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue