Hi,

I'm writing a module requires that one of the pages it renders does not get cached. Is there a way to ensure it does not get cached for non-registered users even if aggressive caching is enabled?

-BTM

Comments

criznach’s picture

The pages should not be cached if you create the page callbacks in the ($may_cache==false) portion of hook_menu. Since they are not cached, page_get_cache in bootstrap.inc can not retrieve them, so they will always be rendered.

btmash’s picture

Ack...I should have mentioned that I'm creating this module for Drupal 6.x (which no longer has the may_cache parameter)

criznach’s picture

I read somewhere that 6 is using hook_init to handle non-cached items. I haven't looked at the docs personally, but maybe someone else here knows. I'm sure someone on #drupal-support on IRC knows. They probably wrote it. :)

btmash’s picture

I've been reading up on it and you can use hook_boot to stop the page from getting cached. However, it seems to work up to regular caching settings. I haven't been able to figure out a way to clear the cache for a page even on aggressive settings. Any ideas?

mcarbone’s picture

I'm not sure hook_boot covers all cases.

It would be nice if it could be an element of hook_menu for each menu item, so you could say for a particular path: never cache this. That would help with the problem I encountered on protected node, for example: http://drupal.org/node/267536