Do not check existance before fetch

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2017-10-19 11:03:31 +02:00
parent 07b6e234bd
commit a6760560c6
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 7 additions and 14 deletions

View File

@ -169,24 +169,17 @@ abstract class Proxy {
* @return mixed|null
*/
public function getFromCache($key) {
if(is_null($this->cache) || !$this->isCached($key)) {
if($this->cache === null) {
return null;
}
$key = $this->getCacheKey($key);
return json_decode(base64_decode($this->cache->get($key)));
}
/**
* @param string $key
* @return bool
*/
public function isCached($key) {
if(is_null($this->cache)) {
return false;
$value = $this->cache->get($key);
if ($value === null) {
return null;
}
$key = $this->getCacheKey($key);
return $this->cache->hasKey($key);
return json_decode(base64_decode($value));
}
/**