[BridgeAbstract] replace getCacheDuration method by CACHE_TIMEOUT class constant

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-09-25 17:04:28 +02:00
parent ad534444fa
commit 235c985901
81 changed files with 84 additions and 332 deletions

View file

@ -6,6 +6,7 @@ abstract class BridgeAbstract implements BridgeInterface {
const URI = '';
const DESCRIPTION = 'No description provided';
const MAINTAINER = 'No maintainer';
const CACHE_TIMEOUT = 3600;
const PARAMETERS = array();
public $useProxy = true;
@ -252,7 +253,7 @@ abstract class BridgeAbstract implements BridgeInterface {
if(!is_null($this->cache)){
$this->cache->prepare($inputs);
$time = $this->cache->getTime();
if($time !== false && (time() - $this->getCacheDuration() < $time)){
if($time !== false && (time() - static::CACHE_TIMEOUT < $time)){
$this->items = $this->cache->loadData();
return;
}
@ -306,10 +307,6 @@ abstract class BridgeAbstract implements BridgeInterface {
return static::URI;
}
public function getCacheDuration(){
return 3600;
}
public function setCache(\CacheAbstract $cache){
$this->cache = $cache;
}