I am running a Drupal 7 website with "Cache pages for anonymous users" and "Cache blocks" enabled. Both "Minimum cache lifetime" and "Expiration of cached pages" are set to 1 day.
When I update a node, for example, edit a picture, and visit that page as an anonymous user, the new picture isn't being displayed. When I manually clear the cache the page is displayed as it should be. It's like the cache isn't cleared after the node is updated.
Extract of the API:
function node_form_submit($form, &$form_state) {
$node = node_form_submit_build_node($form, $form_state);
$insert = empty($node->nid);
node_save($node);
// Do stuff...
// Clear the page and block caches.
cache_clear_all();
}
Notice that the function cache_clear_all is called after the node is saved, regardless if the node needs to be inserted or updated.
Further inspection of the API reveals the following:
function node_save($node) {
...
// Save the node and node revision.
if ($node->is_new) {
drupal_write_record('node', $node);
...
}
else {
drupal_write_record('node', $node, 'nid');
...
}
...
// Clear the static loading cache.
entity_get_controller('node')->resetCache(array($node->nid));
...
}
Again, everything seems to be as it should be. The cache is cleared using the Entity API (public DrupalDefaultEntityController::resetCache(array $ids = NULL)
).
Nothing seems to be wrong in the code. Maybe the code doesn't clear all of the necessary cache?