Answers.Body: <p>I'm going to add an answer (don't want to bury this in the comments) that for a 4.7.17 - with two separate databases - drupal and civicrm; this is NOT an issue; </p>
  
  <p>My view with custom data before and after and in-between:</p>
  
  <pre><code>[karin@louise bin]$ sudo -u apache drush civicrm-upgrade-db
  Starting with v4.7.16 -&gt; v4.7.17 upgrade ..                                                                                                      
  </code></pre>
  
  <p>Specifically trying to just drush cc all:</p>
  
  <pre><code>[karin@louise bin]$ sudo -u apache drush cc all
  </code></pre>
  
  <p>is fine - the way they were on 4.7.16 - with CiviCRM Custom field listed under Fields</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-18T23:16:35.897Z
Answers.LastActivityDate: 2017-03-18T23:22:03.210Z
Answers.LastEditDate: 2017-03-18T23:22:03.210Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p><a href="https://issues.civicrm.org/jira/browse/CRM-20292" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-20292</a></p>
  
  <p>Hi gang,</p>
  
  <p>I'd love to fix the above bug for the core. Does anyone know the best way to solve it, or where I should begin to look for anything that may cause it?</p>
  
  <ol>
  <li>Create a Drupal View using custom data from CiviCRM contacts. </li>
  <li>Save</li>
  <li>Run drush cc all on the command line</li>
  <li>Reload the admin page for the View </li>
  <li>Observe that the custom fields have gone missing, and are not available in the field list. </li>
  <li>Click save on the View. </li>
  <li>Observe that the custom fields are now present in the list.</li>
  </ol>
  
  <p>This is observed in an instance where Civi and Drupal share a DB on 4.7.17.</p>
  
  <p><strong>Update 1</strong>
  The bug appears to be that after drush clear CRM_Core_BAO_Cache::getItem('contact fields', $cacheKeyString); isn't returning custom fields in exportableFields sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php. It does upon clicking "save" in the view, however.</p>
  
  <p>Does anyone know where these are populated from, or have any guidance about where to go from here?</p>
  
  <p>John</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-17T19:29:05.767Z
Comments.Text: John - is this only the case with separate dbs for Drupal v civicrm? I know I have seen this occasionally in the latter case, but suspected it was some unique situation with the hosting platform when we were trying Pantheon i think it was
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-17T22:45:29.423Z
Comments.Text: @petednz-fuzion I updated the quezzy for you my bezzy.
Comments.UserDisplayName: JohnFF
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-17T23:08:23.357Z
Comments.Text: I seem to recall that `drush cc all` doesn't actually clear "all" caches, just all Drupal caches; I'm not sure of details or if even that much is true, but maybe something to look at.
Comments.UserDisplayName: TwoMice
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T00:51:50.403Z
Comments.Text: I'm using drush lots and have lots of views w/ custom fields and I have not run into this yet  And we have separate dbs
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T15:15:08.153Z
Comments.Text: @KarinG-SemperIT What version of civi are you on?
Comments.UserDisplayName: JohnFF
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-18T23:05:56.357Z
Comments.Text: 4.7.16 - and just tried to specifically reproduce what you describe - but all is well; lemme try go to 4.7.17 on this dev site;
Comments.UserDisplayName: KarinG - Semper IT
Tags: <drupal-views><drush>
Title: What's the best way to fix this Drush clear cache bug?
ThreadText: # What's the best way to fix this Drush clear cache bug?
  
  (Asked by: username_0 on 2017-03-17)
  
  <https://issues.civicrm.org/jira/browse/CRM-20292>
  
  Hi gang,
  
  I'd love to fix the above bug for the core. Does anyone know the best way to solve it, or where I should begin to look for anything that may cause it?
  
  1. Create a Drupal View using custom data from CiviCRM contacts.
  2. Save
  3. Run drush cc all on the command line
  4. Reload the admin page for the View
  5. Observe that the custom fields have gone missing, and are not available in the field list.
  6. Click save on the View.
  7. Observe that the custom fields are now present in the list.
  
  This is observed in an instance where Civi and Drupal share a DB on 4.7.17.
  
  **Update 1**
  The bug appears to be that after drush clear CRM\_Core\_BAO\_Cache::getItem('contact fields', $cacheKeyString); isn't returning custom fields in exportableFields sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php. It does upon clicking "save" in the view, however.
  
  Does anyone know where these are populated from, or have any guidance about where to go from here?
  
  John
  
  **Tags:** drupal-views, drush
  
  > **Comments:**
  > **username_1**: John - is this only the case with separate dbs for Drupal v civicrm? I know I have seen this occasionally in the latter case, but suspected it was some unique situation with the hosting platform when we were trying Pantheon i think it was  
  > **username_0**: @petednz-fuzion I updated the quezzy for you my bezzy.  
  > **username_2**: I seem to recall that `drush cc all` doesn't actually clear "all" caches, just all Drupal caches; I'm not sure of details or if even that much is true, but maybe something to look at.  
  > **username_3**: I'm using drush lots and have lots of views w/ custom fields and I have not run into this yet  And we have separate dbs  
  > **username_0**: @KarinG-SemperIT What version of civi are you on?  
  > **username_3**: 4.7.16 - and just tried to specifically reproduce what you describe - but all is well; lemme try go to 4.7.17 on this dev site;  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2017-03-18. Score: 1
  
  I'm going to add an answer (don't want to bury this in the comments) that for a 4.7.17 - with two separate databases - drupal and civicrm; this is NOT an issue; 
  My view with custom data before and after and in-between:
  [karin@louise bin]$ sudo -u apache drush civicrm-upgrade-db
  Starting with v4.7.16 -> v4.7.17 upgrade ..                                                                                                      
  
  Specifically trying to just drush cc all:
  [karin@louise bin]$ sudo -u apache drush cc all
  
  is fine - the way they were on 4.7.16 - with CiviCRM Custom field listed under Fields
  
  
  ---
  
  