From ce18ad0fef3f462f99056780f8ffa29958236ca6 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 6 Sep 2018 15:26:22 +1200 Subject: [PATCH] Do not cache NULL when it is likely a cache miss --- CRM/Core/BAO/Cache.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index dab2f421f6..b377184b7f 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -82,7 +82,10 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { $data = $rawData ? self::decode($rawData) : NULL; self::$_cache[$argString] = $data; - $cache->set($cleanKey, self::$_cache[$argString]); + if ($data !== NULL) { + // Do not cache 'null' as that is most likely a cache miss & we shouldn't then cache it. + $cache->set($cleanKey, self::$_cache[$argString]); + } } } return self::$_cache[$argString]; -- 2.25.1