Prevent cache when updating with field_attach_update I have a problem with caching. I've set up a menu hook for an URL like /user/USER_ID/some_info, which automatically receives the entire user object because of the way I set up my menu hook (see below).

The problem I'm facing is that I have all caching modules enabled in Drupal (including EntityCache) and the $usr variable gets passed from the cache. So naturally if I update a field and save it using field_attach_update, the data is saved into the DB, but the old data is shown on the form, confusing the admins (the checkbox is checked, even though I just unchecked it, and it's value in the DB is in fact 0).

Is there a way I can disable caching for this particular object ($usr) in this particular function?

Note: on my local machine where caching is pretty much disabled, it works fine, both the UI and DB get updated.

My menu hook:

$items['user/%user/some_info'] = array(
    'title' =&gt; 'Some Info',
    'description' =&gt; 'Edit',
    'page callback' =&gt; 'mymodule_edit_user',
    'page arguments' =&gt; array(1),
    'access arguments' =&gt; array('administer users'),
    'file' =&gt; 'mymodule.pages.inc',
    'type' =&gt; MENU_LOCAL_TASK,
    'weight' =&gt; 8
);


The function that gets executed:

function mymodule_edit_user($usr){
    // check if POST and validation here
    if(isset($_POST['somefield'])) //checkbox
        $usr-&gt;field_somefield[LANGUAGE_NONE][0]['value'] = 1;
    else
        $usr-&gt;field_somefield[LANGUAGE_NONE][0]['value'] = 0;

    field_attach_update('user', $usr);
}
Sorry I didn't do more digging before asking this, but going to answer my own question in case someone else finds this.

I've taken a look inside the user_save function, and seen that it does some invoking, so I did it too. Surprise: it worked (EntityCache was the bad guy who was caching everything BTW).

Here's my code for reference:

$usr-&gt;field_somefield[LANGUAGE_NONE][0]['value'] = 0;
field_attach_presave('user', $usr);
module_invoke_all('entity_presave', $usr, 'user');
module_invoke_all('entity_update', $usr, 'user');
field_attach_update('user', $usr);