CRM_Utils_Cache_SqlGroup - Don't encourage infinite recursion
authorTim Otten <totten@civicrm.org>
Fri, 30 Mar 2018 01:57:26 +0000 (18:57 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 19 Jun 2018 21:41:22 +0000 (14:41 -0700)
The `deleteGroup(...$clearAll...)` option is heavy-handed and leads to
call-paths that hard to grok.

In the current design of CRM_Core_BAO_Cache (with multi-tier caching), one
does need to clear these things.  But let's not clear everything under the
sun...

CRM/Utils/Cache/SqlGroup.php

index 6f3f45f792743f727bab58ff670ecca6a40e8451..0bb8e98e277a5ee090184a7889027bc9b81e845a 100644 (file)
@@ -121,12 +121,16 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
    * @param string $key
    */
   public function delete($key) {
-    CRM_Core_BAO_Cache::deleteGroup($this->group, $key);
+    CRM_Core_BAO_Cache::deleteGroup($this->group, $key, FALSE);
+    CRM_Core_BAO_Cache::$_cache = NULL; // FIXME: remove multitier cache
+    CRM_Utils_Cache::singleton()->flush(); // FIXME: remove multitier cache
     unset($this->frontCache[$key]);
   }
 
   public function flush() {
-    CRM_Core_BAO_Cache::deleteGroup($this->group);
+    CRM_Core_BAO_Cache::deleteGroup($this->group, NULL, FALSE);
+    CRM_Core_BAO_Cache::$_cache = NULL; // FIXME: remove multitier cache
+    CRM_Utils_Cache::singleton()->flush(); // FIXME: remove multitier cache
     $this->frontCache = array();
   }