Prevent uncessary cache refresh for deactivated blocks
aymerick - May 31, 2007 - 09:49
| Project: | Block Cache |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Actually, by default, all cached blocks are refreshed on these actions:
- A node is added/updated/deleted
- A comment is added/updated/deleted
- A user is added/updated/deleted
- A user logs in our out
... and this apply for not activated blocks too !
I think it is unecessary overhead (a 'DELETE FROM {cache_block}' query is called for every deactivated blocks... and this may happen a lot on busy sites), and so by default refresh of blocks should be deactivated.
An admin must know what he does when he activate a cached block, and there is already a warning message "If none are checked AND cache lifetime is left blank, the contents of this block will NEVER refresh.".
| Attachment | Size |
|---|---|
| blockcache-norefresh.patch | 1.89 KB |

#1
I had a short look at this and it seems to me that everything is working fine.?
#2
Patched and works without errors. Is a "must-patch". Let's get it live.
#3
Hi,
Is a update of this module including this patch to version 6 possible? I need it badly. Thanks.
#4
This patch should be committed live.
We were getting this issue
http://drupal.org/node/258209
Once we committed this patch, the issue ceased.
Cheers,
G
#5
Here's an updated patch against blockcache.module 1.7.2.8 (the latest version). Same functionality as the patch in #0, but rolled against 1.7.2.8 instead of 1.7.2.4.
The patch does two things:
1) Changes the default so that none of the "Refresh When" checkboxes are checked.
2) If a blockcache block doesn't have any settings (ie., the admin has not configured and saved the blockcache block at least once), then assume that the block should not be refreshed.
The part that was killing my server was having all INACTIVE Block Cache blocks (ie., the hundreds of them I hadn't configured and specifically set to not refresh all the time, because I wasn't using them) refreshed on cron runs.
I agree with the others. This patch should be committed. I know we're nearing the end of support for Drupal 5.x, but there are still a lot of production sites on it. (BTW, I don't know if this issue is still relevant for D6.)
For others running into this issue, see also these issues:
http://drupal.org/node/204029 (Good explanation of what's going on in comment #9)
http://drupal.org/node/258209 (The OP has the heinous DELETE query that's causing the problems. This issue is how I found this patch.)