Skip to content

Commit

Permalink
Updated logic in useLocalCache to reuse getCacheId
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-andreyev committed Aug 11, 2019
1 parent de5f03d commit 6fec49a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions PEAR/REST.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,7 @@ function retrieveData($url, $accept = false, $forcestring = false, $channel = fa
function useLocalCache($url, $cacheid = null)
{
if (!is_array($cacheid)) {
$cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
md5($url) . 'rest.cacheid';
if (!file_exists($cacheidfile)) {
return false;
}

$cacheid = unserialize(implode('', file($cacheidfile)));
$cacheid = $this->getCacheId($url);
}

$cachettl = $this->config->get('cache_ttl');
Expand All @@ -191,6 +185,11 @@ function useLocalCache($url, $cacheid = null)
return false;
}

/**
* @param string $url
*
* @return bool|mixed
*/
function getCacheId($url)
{
$cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
Expand Down

0 comments on commit 6fec49a

Please sign in to comment.