While working on enhancing the Rules caching #2189645 I came across following scenario:
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core); and there's
entity_flush_caches() which calls
entity_defaults_rebuild(). This entity rebuild, goes through
RulesPlugin::save() which calls
And there it is, the whole rules cache is lost, no matter if the items where expired or not. On a site with a lot of rules this can lead to stampeding since the rebuild of the rules cache hasn't locking yet ()
Features had a similar problem and introduced a variable to disable rebuilding on cache flushes.
We could reuse this and hook into the features rebuilding process.
This by implementing
hook_features_rebuild() and run the entity rebuilding when it is invoked.
entity_flush_caches() we can do a check for the variable of features. If it's there and disabled rebuild on cache flush it means features is installed will takes care of the rebuilding. If the variable isn't set / rebuild on cache flush is enabled we act as usual and do a rebuild.
User interface changes