Updating Node Field using drupal_write_record doesn't show changes until cache flush Problem is in the title basically, I'm trying to update a specific field in my node and I have to do it by using drupal_write_record rather than loading and modifying the node object itself, or by using node_save etc, but my changes aren't being reflected until I flush the caches for the site.

Is there something I need to do to have Drupal immediately aware of the changes?

Code:

$next_delta = db_query('SELECT MAX(delta) + 1 AS del FROM {field_data_my_field} WHERE entity_id = :nid', array(':nid' =&gt; $nid))-&gt;fetchField();
  $data = array(
    'entity_type' =&gt; 'node',
    'bundle' =&gt; $node-&gt;type,
    'deleted' =&gt; 0,
    'entity_id' =&gt; $node-&gt;nid,
    'revision_id' =&gt; $node-&gt;vid,
    'language' =&gt; LANGUAGE_NONE,
    'delta' =&gt; $next_delta,
    'field_my_data' =&gt; 1,
  );
  drupal_write_record('field_data_my_field', $data);
  drupal_write_record('field_revision_my_data', $data);


I've tried adding entity_get_controller('node')-&gt;resetCache(array($node-&gt;nid)); into the code but that's not doing it either.
When you write directly to the table (which drupal_write_record() does), it bypasses any APIs that are called. As such, you should really only use drupal_write_record() for tables you've created yourself, that don't have any APIs to be bypassed.
In this case, you are better off changing the values in the $node, then calling node_save() on it. This will not bypass any APIs.