My site has a lot of complex blocks, all being served to anonymous users. You wrote that your module helps performance for authenticated users, but does it also help for anonymous ones?
Thanks very much!

Comments

swentel’s picture

Status: Active » Fixed

Of course, but the best thing still is to have page caching on too. And when you are using one of the two blockcache alter patch's, you'll benefit more from it as not every block has to be rebuilt when the page is served.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sittard’s picture

Status: Closed (fixed) » Active

I've created a custom block which detects the visitors country (from their IP address) and displays a country specific message. I've setup the block to have BLOCK_NO_CACHE and in the block cache alter settings I've also selected 'Do not cache'. I've applied the core patch (blockcache_alter_no_node_grants).

The block works fine for anonymous users without page caching turned on, but as soon as I select 'Normal (recommended for production sites, no side effects)' as the page caching it appears that the block is getting cached (per page).

I would have assumed that 'No cache' would mean never cache this block.

Thanks.

swentel’s picture

Status: Active » Closed (fixed)

That's page caching, can't really do anything about that.

sittard’s picture

Thanks - that was pretty much my thinking as well.

I think the two possible solutions are:

- Turn off page caching (but leave block caching on)
- Turn on page caching and use an iframe and some custom PHP code to display the country specific messages.

Thanks,
Stephen.

puddyglum’s picture

Please see Caches cleared upon node save, I've posted some code which re-caches pages when a block is modified. It relies about the hook_nodeapi(), so it only updates blocks/re-caches pages when a node is added/updated/deleted. When a node is added/updated/deleted, node.module from core will clear all cache anyway. But that's not an option for sites that really need page caching. I've set the minimum cache lifetime to be 18 hours, and then I use a crawler to re-cache the site during the night.

Although I'm also using Authcache module, the code should work fine for sites that just use blockcache_alter

This basically allows Anonymous users to view cached content, without fear that the pages are out of date.

puddyglum’s picture

Category: support » feature
Status: Closed (fixed) » Needs work
StatusFileSize
new4.88 KB

Re-opening this bug because I really think somebody could take when I've got and make it generic for all site configurations.

Attached it the code.

swentel’s picture

Status: Needs work » Fixed
StatusFileSize
new865 bytes

There's some hardcoded stuff indeed there. Instead I've added some code so other modules can implement a hook and cleanup as they like.

function hook_blockcache_alter_cleanup($type, $relatednodetype, &$info) {

}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.