From a38c3c6faecd8740c37afa21f9e33e4139a4be45 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Mon, 30 Nov 2020 22:36:17 +0100 Subject: [PATCH] Let serve_page_through_redis_cache return string --- MD_STD_CACHE.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/MD_STD_CACHE.php b/MD_STD_CACHE.php index 8019f74..ce35550 100644 --- a/MD_STD_CACHE.php +++ b/MD_STD_CACHE.php @@ -23,9 +23,9 @@ final class MD_STD_CACHE { * @param string $redisKey Key to cache by in redis. * @param integer $expiry Expiration time in seconds. * - * @return boolean + * @return string */ - public static function serve_page_through_redis_cache(string $redisKey, int $expiry = 3600):bool { + public static function serve_page_through_redis_cache(string $redisKey, int $expiry = 3600):string { $redis = new Redis(); $redis->connect(self::$redis_host, self::$redis_port, 1, NULL, 0, 0, ['auth' => [MD_CONF::$redis_pw]]); @@ -34,9 +34,8 @@ final class MD_STD_CACHE { ob_start(); if (($redisResult = $redis->get($redisKey))) { - echo $redisResult; $redis->close(); - return true; + return $redisResult; } else { @@ -58,7 +57,7 @@ final class MD_STD_CACHE { } $redis->close(); - return false; + return ''; } }