Let serve_page_through_redis_cache return string

This commit is contained in:
Joshua Ramon Enslin 2020-11-30 22:36:17 +01:00
parent 57da808a6a
commit a38c3c6fae
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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 '';
}
}