Stop using cache in MD_STD_CACHE when run from command line

This commit is contained in:
Joshua Ramon Enslin 2020-12-02 09:39:43 +01:00
parent 35c0fe4723
commit 886acead63
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -48,6 +48,8 @@ final class MD_STD_CACHE {
*/ */
public static function serve_page_through_redis_cache(string $redisKey, int $expiry = 3600):string { public static function serve_page_through_redis_cache(string $redisKey, int $expiry = 3600):string {
if (PHP_SAPI === 'cli') return '';
$redis = new Redis(); $redis = new Redis();
$redis->connect(self::$redis_host, self::$redis_port, 1, NULL, 0, 0, ['auth' => [MD_CONF::$redis_pw]]); $redis->connect(self::$redis_host, self::$redis_port, 1, NULL, 0, 0, ['auth' => [MD_CONF::$redis_pw]]);
if ($redis->ping() !== false) { if ($redis->ping() !== false) {