5

I've seen from a different question a suggestion to use CRM_Core_Invoke::rebuildMenuAndCaches() as the "granddaddy" of all cache flushing. However, I'd like to know if this is only clearing the cache in the database, such as civicrm_cache and so on or if it also clears non-database cache as well such as memcache.

As far as I can tell the above function calls CRM_Core_Config::cleanupCaches() which calls CRM_Core_Config::clearDBCache() and that function truncates various cache tables. Am I missing something? How do the other caching backends get flushed?

1
  • I found this under api/v3/Job.php: if ( $dbCache ) { CRM_Core_Config::clearDBCache( ); } if ( $memCache ) { CRM_Utils_System::flushCache( ); } which seems to confirm my suspicion that there are two ways to clear the cache depending on what backend caching method is using.
    – herb
    Commented May 23, 2015 at 18:01

2 Answers 2

3

Currently the function CRM_Core_Invoke::rebuildMenuAndCaches does not flush the memory caches, even though it will rebuild the database cache, menus and sessions. In order to also flush the memory caches you need to also call: CRM_Utils_System::flushCache( ); (This was confirmed by Lobo but I think it needed to be written more explicitly as an answer and not as how things should be.)

2

I think the function CRM_Core_Invoke::rebuildMenuAndCaches should also flush the memory caches, and hence call: CRM_Utils_System::flushCache( );

This will make things more consistent and actually rebuild all caches as the function name suggests

2
  • Can you edit and clarify your answer Lobo? Are you saying currently CRM_Core_Invoke::rebuildMenuAndCaches does not flush the memory caches? So if I want to clear the memory caches I need to call CRM_Utils_System::flushCache()? And should I create an issue to patch core?
    – herb
    Commented May 24, 2015 at 14:23
  • yes, i would create an issue and submit a PR to add the changes to the rebuild function Commented May 25, 2015 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.