not compatible with block cache in drupal 6
BenKewell - January 15, 2009 - 14:08
| Project: | Header image |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
as title
the header image block shows nothing to anonymous when block cache is enabled
works fine when block cache is disabled

#1
well seems that the block cache holds the first version of the header image block after clearing the cache
and then showing it for every appearance of the header image block
resulting in a wrong header image being shown
#2
Well, I haven't had the opportunity to try what I'm going to suggest, but I think it is the solution for this problem.
I've noticed elsewhere in drupal 6 that there's a possibility to set the caching method for a block, written like this: $blocks[$name]['cache'] = BLOCK_NO_CACHE;
We'll probably need to change the line it a bit so it works in this module.
Hopefully someone tries it this evening, I'm going to need this module tomorrow ;)
#3
Same issue on our site with block cache enabled the image does not change.
Disable Block Cache and the problem is fixed.
#4
Same issue. Seems that this is a show stopper for sites that use caching.
#5
I've added some code right after line 123
123 $blocks[$key]['info'] = check_plain($name);124 $blocks[$key]['cache'] = BLOCK_NO_CACHE;
This should normally fix the caching problem.
#6
Subscribing. I'm having the same problem with some menu items. Question: Is there a way to selectively cache some blocks but not others in Drupal 6? (I'm using 6.10).
#7
This module http://drupal.org/project/blockcache_alter looks promising in that it seems to allow block-by-block caching. Has anyone tried it in D6?
#8
The attached patch sets all Header Image blocks to be no-cache. More elegant solutions can be implemented in the future, but this solves the biggest problem.
#9
I tried the patch on about 10 sites (all very similar, and under development), and it works.
You suggest more elegant solutions: did you have something specific in mind? I am wondering what use-cases there could be where Headerimage-blocks need to be cached. If a person needs just a single static image at the top of every page, there are better ways to achieve that than using Headerimage.
http://api.drupal.org/api/constant/BLOCK_NO_CACHE/6 says to use this constant:
1. for simple blocks (notably those that do not perform any db query),
2. where querying the db cache would be more expensive than directly generating the content.
3. for blocks that change too frequently.
I believe #3 applies here.