CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • civicrm_group_contact_cache
Pages: [1]

Author Topic: civicrm_group_contact_cache  (Read 817 times)

civicrmsav

  • I post frequently
  • ***
  • Posts: 121
  • Karma: 5
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7.x
civicrm_group_contact_cache
June 06, 2012, 11:47:30 am
Should civicrm_group_contact_cache always be up to date?   I've been working on a bit of an ad hoc project and every once in a while I check that table and it has no records in it.  I haven't been able to reproduce it reliably and was wondering what the expected behavior was.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: civicrm_group_contact_cache
June 06, 2012, 04:46:54 pm
No, that's not a great behaviour. I've had problems with that when it has struggled to recreate the cache - e.g when a smart group includes it's parent group in it's criteria.

But it's usually pretty tricky to track down :-(
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

civicrmsav

  • I post frequently
  • ***
  • Posts: 121
  • Karma: 5
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7.x
Re: civicrm_group_contact_cache
June 07, 2012, 08:39:07 am
My smart groups are all really simple - just zip selects, nothing nested or complicated - they are however rather long with lots of individual zips listed.

If I were to update the cache programatically, could I trust that it would stay updated and not suddenly truncate on me while I'm doing my queries?     And would I just loop through each smart group I was interested in and call CRM_Contact_BAO_GroupContactCache.check?   

Thanks

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: civicrm_group_contact_cache
June 07, 2012, 02:42:02 pm

1. It can be empty if the cache date is not set. In this case the civi code will fill up the cache before using it

2. Currently we've conveniently ignored the race condition (where the cache is emptied while someone else is using it). Would be good to address this issue. Would you be interested in designing a solution for this? I suspect a simple locking mechanism will suffice (and ensuring u avoid deadlocks)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

civicrmsav

  • I post frequently
  • ***
  • Posts: 121
  • Karma: 5
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7.x
Re: civicrm_group_contact_cache
June 07, 2012, 07:48:25 pm
I might be interested - but would need some help getting oriented to how it works now and how it might work in the future.  What's the best way to do that?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: civicrm_group_contact_cache
June 07, 2012, 08:59:32 pm

might want to start by reading:

http://book.civicrm.org/developer/

and then taking a look at the code and places you might need to fix. The main file is: CRM/Contact/BAO/GroupContactCache.php

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • civicrm_group_contact_cache

This forum was archived on 2017-11-26.