From 22263d41db90acee0220259d37e16f1b36ab76ab Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 6 Sep 2018 14:44:55 +1200 Subject: [PATCH] Do not treat an empty array as not set in caches. On testing Redis we found that even after Redis cache had been built the set function was still being called. It turned out the reason is that when a value was set to an empty array that was being treated as FALSEY. In fact the cache function returns NULL if nothing is set & no default is specified & we should only treat NULL as a cache miss --- CRM/Core/BAO/Cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index d1f97f63f6..dab2f421f6 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -75,7 +75,7 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { $cache = CRM_Utils_Cache::singleton(); $cleanKey = self::cleanKey($argString); self::$_cache[$argString] = $cache->get($cleanKey); - if (!self::$_cache[$argString]) { + if (self::$_cache[$argString] === NULL) { $table = self::getTableName(); $where = self::whereCache($group, $path, $componentID); $rawData = CRM_Core_DAO::singleValueQuery("SELECT data FROM $table WHERE $where"); -- 2.25.1