(dev/core#174) System::flushCache() - Continue existing behavior aftering fixing...
authorTim Otten <totten@civicrm.org>
Mon, 18 Jun 2018 21:58:10 +0000 (14:58 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 19 Jun 2018 21:41:22 +0000 (14:41 -0700)
The preceding update to `CRM_Utils_Cache` meant that `CRM_Utils_Cache::singleton()->flush()`
(aka `Civi::cache()->flush()`) would flush only the *default* cache. This revision
ensures that a general system-flush still hits the same caches.

However, we can now define *other* caches which *won't* be hit by system-flush.

CRM/Utils/System.php

index e2d72f5303244d9eb8c031c82696994bedd3f47f..e88076c21735a520bf9440825df4d50f55421673 100644 (file)
@@ -1416,8 +1416,14 @@ class CRM_Utils_System {
   public static function flushCache() {
     // flush out all cache entries so we can reload new data
     // a bit aggressive, but livable for now
-    $cache = CRM_Utils_Cache::singleton();
-    $cache->flush();
+    CRM_Utils_Cache::singleton()->flush();
+    if (Civi\Core\Container::isContainerBooted()) {
+      Civi::cache('settings')->flush();
+      Civi::cache('js_strings')->flush();
+      Civi::cache('community_messages')->flush();
+      CRM_Extension_System::singleton()->getCache()->flush();
+      CRM_Cxn_CiviCxnHttp::singleton()->getCache()->flush();
+    }
 
     // also reset the various static memory caches