Whenever I edit a node all my page caches are cleared.
As per the design : This behavior is intended behavior and works as per the design. If you look at the node_form_submit()
node submit handler function within the node module you will notice that there is a cache_clear_all()
As the comment in the line above the function call reads it clears the page and blocks cache as expected.
Reason for clearing all the caches: When a node is created/updated there can be many pages in the site which are dependent on the current node in question. It is next to impossible/very difficult identify all the dependencies and clear the caches only for those pages. For this particular reason, to make sure that no stale data is served to the end user drupal by default clears all the caches.
Work Around :
Approach 1 : Since node_form_submit
is form submit handler you could just implement a hook_form_alter()
and change the submit handler to your own function which can omit cache_clear_all()
function call.
Approach 2 : Set Minimum Cache Life Time to a high value. (By doing this you are asking Drupal not to clear caches if they are not older than the specified Minimum Cache Life time. So now if you edit a node, the changes will not be visible immediately. Your changes will only be visible when time elapsed is greater than Minimum Cache Life time and next general cache wipe has occured.)
Once you have set the Minimum Cache Life Time you can use Expire module to implement your custom logic for Invalidating a cache. You can have settings such that whenever a node is edited drupal can clear the cache for that particular page and all the listing pages.
EDIT(After @MPDs comment) : If you are using a reverse proxy server then you might need to consider setting the Expiration of cached pages to an appropriate value and probably consider using purge module.
Futher Reading : Difference between Minimum Cache Lifetime and Expiration of Cached Pages value.