Skip to content

Commit e28643e

Browse files
authored
Merge pull request #94 from oleg-andreyev/unify-getcacheid
Updated logic in useLocalCache to reuse getCacheId
2 parents e278a34 + 6fec49a commit e28643e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

PEAR/REST.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,7 @@ function retrieveData($url, $accept = false, $forcestring = false, $channel = fa
173173
function useLocalCache($url, $cacheid = null)
174174
{
175175
if (!is_array($cacheid)) {
176-
$cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
177-
md5($url) . 'rest.cacheid';
178-
if (!file_exists($cacheidfile)) {
179-
return false;
180-
}
181-
182-
$cacheid = unserialize(implode('', file($cacheidfile)));
176+
$cacheid = $this->getCacheId($url);
183177
}
184178

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

188+
/**
189+
* @param string $url
190+
*
191+
* @return bool|mixed
192+
*/
194193
function getCacheId($url)
195194
{
196195
$cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .

0 commit comments

Comments
 (0)