0

enter image description here

In performance I have caching turned off, yet if I update a value in the DB directly I have to flush the cache to see changes on my site. Why is that? (ex: using phpmyadmin and changing a value)

I'm inserting/updating values to my DB externally from another server that is not using Drupal. (using mysql)

How can I make my Drupal website automatically reflect the changes when the DB values change?

5
  • What values are you changing in the database? I'm fairly sure you are changing the wrong table values. Also, it is normal for Drupal to cache many things (menu routers, links, node content, etc) even if you turn off all caches in the performance page.
    – AKS
    Commented Mar 12, 2016 at 5:51
  • I'm fairly sure you are changing the wrong table values that cannot be, because when I flush the cache the outputted value on the website changes.
    – No Sssweat
    Commented Mar 12, 2016 at 5:57
  • What tables are you modifying?
    – AKS
    Commented Mar 12, 2016 at 5:58
  • What values are you changing in the database? It's just a field I added to my content type. So when I go to my database it's field_data_field_custom.
    – No Sssweat
    Commented Mar 12, 2016 at 5:58
  • 1
    Keep in mind there is a table for the field revisions. Then, that page is for caching pages, not for caching other things; you aren't telling Drupal to completely avoid caching.
    – avpaderno
    Commented Mar 12, 2016 at 7:56

2 Answers 2

1

The settings you are referring just tell Drupal to use the cache_page table.
See drupal_page_footer() that contains the following code.

  if (variable_get('cache', 0) && ($cache = drupal_page_set_cache())) {
    drupal_serve_page_from_cache($cache);
  }
  else {
    ob_flush();
  }

For the fields, there is the cache_field table (cleared by field_cache_clear()), which is used from the field CRUD API, but also from the field attach API, which includes functions like field_attach_load() or field_attach_update(). If you are writing a field table without using one of the field API functions, such as in your case, then you need to clear the field cache; if you look at the code of field_attach_update() you can understand exactly which cache ID you should pass, to avoid clear all the cache for no reason.

0

Keep in mind there is a table for the field revisions. Then, that page is for caching pages, not for caching other things; you aren't telling Drupal to completely avoid caching. – kiamlaluno♦

You got my wheels turning.

After looking at the DB, it's true, I see cache_field table. It's probably best not to tell drupal to completely avoid caching.

I think it will be better if I just tell mysql to delete the row that I need in table cache_field.

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.