From 39044de8ad7d05cd07e51ee0f10149d465205012 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 6 Apr 2018 10:54:28 +1200 Subject: [PATCH] FIX Use correct CacheInterface API methods and remove doubled up logic --- src/Tasks/CurlLinkChecker.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Tasks/CurlLinkChecker.php b/src/Tasks/CurlLinkChecker.php index fa13574..df6fc76 100644 --- a/src/Tasks/CurlLinkChecker.php +++ b/src/Tasks/CurlLinkChecker.php @@ -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); @@ -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; }