I am a bit confused now - is it normal behavior that posting an anonymous comment on cached page invalidates ALL cached pages for whole site for current anonymous user? Beacouse that is exactly what I am experiencing now. Moreover, current anonymous user is not able to cache pages by visiting them in browser. Is it a bug or is it some sort of a cookie? Thank you for answers.

UPDATE1: I created fresh install, set up a few testing nodes with anonymous commenting enabled and it seems that after submitting comment, drupal adds a cookie. In response headers there shows no-cache on all pages.

UPDATE2: I tried @mikeytown's suggestion and tested out alternative database cache http://drupal.org/project/adbc and it turned out to work ok with anonymous comments. After posting a comment on a cached page - all other precached pages are served from database for current anonymous visitor. This is what I expected as default behavior from core drupal cache. As a sidenote - in addition to that I tested content refresh module http://drupal.org/project/content_refresh which flushes cache of the page immediately where comment is posted, which turned out to be working pretty good.

Next I tested submitting comments using ajax http://www.test.eotazky.sk/admin/config/content/ajax_comments . This solution created a session which disabled access to cached pages to current anonymous user. Clearing browser's cache helped.

I tested also other forms on cached pages like poll or closedquestion which use ajax to submit forms and it seems to me that all ajax submitted forms set a session that disable access to cached pages for current anonymous user.

  • Do you have Boost module installed or caching mode set to Aggressive ?
    – AKS
    Feb 18, 2013 at 4:08
  • @AyeshK Caching is just enabled, it is drupal 7.
    – loparr
    Feb 18, 2013 at 10:06
  • @loparr So, what did you decide to use?
    – kalabro
    Feb 20, 2013 at 8:33
  • @kalabro I decided to use mikeytown2's suggestion - alternate cache, which answers my question. However some minor questions remain and hopefully someone can explain it.
    – loparr
    Feb 20, 2013 at 9:19

1 Answer 1


You could give Alternative Database Cache a try. Set the minimum cache lifetime and you should see pages cached within the cache lifetime window not being cleared. Clearing the cache when a comment is saved is default behavior; look at the bottom of the comment_form_submit function if you wish to see the call to cache_clear_all.

As for the cookie, it is most likely being set because of calls to drupal_set_message; also noted is comment_form_submit calls user_cookie_save

  • The answer could be greatly improved with a reason for why this module would be useful.
    – Letharion
    Feb 18, 2013 at 22:19
  • @mikeyintown2 Your advice helped with comments on cached pages. Please see updates to original question. As for the cookies - is it possible to prevent forms to create session which results in disabling acces to cached pages for anonymous user? I say disabling because all pages are not cleared from database.
    – loparr
    Feb 19, 2013 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.