Closed (fixed)
Project:
Block Cache Alter
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2009 at 14:41 UTC
Updated:
28 Feb 2011 at 23:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
swentel commentedOf 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.
Comment #3
sittard commentedI'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.
Comment #4
swentel commentedThat's page caching, can't really do anything about that.
Comment #5
sittard commentedThanks - 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.
Comment #6
puddyglumPlease 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.
Comment #7
puddyglumRe-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.
Comment #8
swentel commentedThere's some hardcoded stuff indeed there. Instead I've added some code so other modules can implement a hook and cleanup as they like.