Our site has Varnish in front of Drupal for anonymous user page requests so that these pages are cached. I know how to clear the Varnish cache within Varnish but my question is what benefit is it to clearing the Drupal cache now that I have Varnish in front of Drupal?
-
It all depends. To answer the converse, one case would be where you have a large site and Varnish caching pages for a short length of time and then using Drupal's cache for longer periods of time. This way Varnish can keep everything that is actively used fresh and in memory, and rely upon Drupal to quickly serve up pages from its cache when necessary. In this case, clearing the Drupal caches would remove potentially stale pages when Varnish came back to ask for more.– JimajammaCommented Nov 13, 2013 at 23:19
Add a comment
|
1 Answer
Whenever Varnish Cache expires it asks Drupal to give it the rendered page. Drupal in turn sees if it can server the page from the Cache. If yes it will server from the cache, else it will regenerate the page.
In short, when you clear the Drupal Cache,
- No changes are visible to end users for whom the content is served from Varnish.
- When the Varnish Cache expires, it will fetch the content form Drupal. Now that you had cleared the Drupal cache, instead of serving from the cache the page will be rebuilt.