This code does a clear on the cache and then calls the api which will eventually
call load(). Load ALSO clears the cache so this seems redundant.
However, there are a couple of places where add() is called from where it might
serve to force the rebuild due to changes to group make up. In general we have switched
to invalidating and letting the rebuild-on-demand do it's thing to allow
things like crons or lack of need for the group to reduce to browser demand.
So, I think that by switching to invalidating rather than rebuilding
we can remove this potentially locky line from GroupContactCache::add()
// update group contact cache for all parent groups
$parentIds = CRM_Contact_BAO_GroupNesting::getParentGroupIds($group->id);
foreach ($parentIds as $parentId) {
- CRM_Contact_BAO_GroupContactCache::add($parentId);
+ CRM_Contact_BAO_GroupContactCache::invalidateGroupContactCache($parentId);
}
}
}
self::flushCaches();
- CRM_Contact_BAO_GroupContactCache::add($group->id);
+ CRM_Contact_BAO_GroupContactCache::invalidateGroupContactCache($group->id);
if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Group', $group->id, $group);
foreach ($groupIDs as $groupID) {
// first delete the current cache
- self::clearGroupContactCache($groupID);
$params = [['group', 'IN', [$groupID], 0, 0]];
// the below call updates the cache table as a byproduct of the query
CRM_Contact_BAO_Query::apiQuery($params, ['contact_id'], NULL, NULL, 0, 0, FALSE);