Source for file DefaultCachePolicy.php
Documentation is available at DefaultCachePolicy.php
* @package php-lastfm-api
* @author Felix Bruns <felixbruns@web.de>
/** last.fm API methods to be cached for a week.
/** The expiration time of weekly charts (defaults to a week).
private $weeklyChartsExpiration;
/** Creates a DaultCachePolicy.
$this->HOUR =
$this->MINUTE *
60;
$this->DAY =
$this->HOUR *
24;
$this->WEEK =
$this->DAY *
7;
$this->MONTH =
$this->WEEK *
4.34812141;
$this->YEAR =
$this->MONTH *
12;
$this->weeklyMethods =
array(
$this->weeklyChartsExpiration =
$this->WEEK;
/** Returns the expiration time by interpreting last.fm API request parameters.
* @param array $params An associative array of last.fm API request parameters.
* @return integer Expiration time in seconds.
$method =
$params['method'];
if(stripos($method, 'Weekly') !==
false &&
stripos($method, 'List') ===
false){
return $this->weeklyChartsExpiration;
return in_array($method, $this->weeklyMethods) ?
$this->WEEK : -
1;
/** Returns the expiration time of weekly charts.
* @return integer The expiration time in seconds.
return $this->weeklyChartsExpiration;
/** Sets the expiration time of weekly charts.
* @param integer $expiration Expiration time in seconds.
$this->weeklyChartsExpiration =
$expiration;
Documentation generated on Mon, 22 Dec 2008 16:57:34 +0100 by phpDocumentor 1.4.1