Skip to content

Commit

Permalink
FIX Use correct CacheInterface API methods and remove doubled up logic
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Apr 5, 2018
1 parent 65a9f11 commit 39044de
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Tasks/CurlLinkChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,15 @@ public function checkLink($href)
return null;
}

$cacheKey = md5($href);
if (!$this->config()->get('bypass_cache')) {
// Check if we have a cached result
$cacheKey = md5($href);
$result = $this->getCache()->load($cacheKey);
$result = $this->getCache()->get($cacheKey, false);
if ($result !== false) {
return $result;
}
}

// Check if we have a cached result
$cacheKey = md5($href);
$result = $this->getCache()->get($cacheKey, false);
if ($result !== false) {
return $result;
}

// No cached result so just request
$handle = curl_init($href);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
Expand All @@ -84,7 +77,7 @@ public function checkLink($href)

if (!$this->config()->get('bypass_cache')) {
// Cache result
$this->getCache()->save($httpCode, $cacheKey);
$this->getCache()->set($cacheKey, $httpCode);
}
return $httpCode;
}
Expand Down

0 comments on commit 39044de

Please sign in to comment.