Hello,
I have a custom written module, and I want to cache one page of it. Are there modules I can use for caching one page? I don't want the rest to be cached.
Thanks,
Joeri
Le mardi 16 novembre 2010 à 12:46 +0100, Joeri De Backer a écrit :
Hello,
I have a custom written module, and I want to cache one page of it. Are there modules I can use for caching one page? I don't want the rest to be cached.
If you are writing a custom module, then in the menu callback function, you can do a cache_get('some_cache_identifier'); and return it, your page is cached!
The first hit, just built the page and do a cache_set(), this is basically the same that the bootstrap will do, except here you cache only your content region, not the full page.
If you really need to cache only one page, try the hook_boot(), check the path in this hook, get your full page cache then return hit and exit(); and it should do the trick. Be careful about what and what not Drupal already did when you reach the hook_boot() (permissions, stuff like that..).
Pierre.