Hi,

With this new release the blocks created with views aren't being cached. Using devel module I can see that the function cache_set() is updating the cache of that block every time the page loads.

Any ideas?

Thanks,
introfini

Comments

swentel’s picture

I'll look into that this weekend. Have you applied one of the patches also that came with the module?

introfini’s picture

Yes I did.

Thanks,
introfini

introfini’s picture

I'm trying to debug this..

blockcache_alter_block_view should be called every time a module is displayed, correct?

introfini’s picture

Status: Active » Closed (fixed)

Problem solved. it was a conflict with another module.

Thanks and sorry for taking your time.

introfini

dropchew’s picture

Hi,

I have this problem too but only using

$block = module_invoke('blockcache_alter', 'block', 'view', 'block,14');
print $block['content'];

It even increases the no. of queries to perform compared to

$block = module_invoke(block, 'block', 'view', 14);
print $block['content'];

However, the block is cached when displaying in a region, so my guess its not modules conflict.

My code is something like this,

$block = module_invoke('blockcache_alter', 'block', 'view', 'viewXXX,block_5');
print $block['content'];

Thanks and its a great module!

dropchew’s picture

Priority: Critical » Normal
Status: Closed (fixed) » Active
introfini’s picture

@dropchew: is that a clean installation or an upgrade from D5?

introfini

dropchew’s picture

Its a clean installation for D6, 1st time use. I checked the results using devel and realise using the modified block snippet performs 1 more query than the original.

introfini’s picture

If you are user number 1, that's normal. If I'm not mistaken the user 1 has no cache enable in the module by design.

introfini

dropchew’s picture

Nope, I am logging as a registered role with access to devel. Just tried again this morning and having the same result.

Btw I think _blockcache_alter_get_cache_id is the extra query being called. Thanks.

liliplanet’s picture

subscribe, thx!

swentel’s picture

@dropchew, I'll investigate the issue further this weekend.

dropchew’s picture

Thanks swentel. Appreciate that.

swentel’s picture

@dropchew : tested it on my local machine here. I created a block in views, went to block administration and put caching mode on 'PER PAGE' for that block, enabled block caching on the performance page and added dsm in the 'blockcache_alter_block_view' function as you can see underneath.

  if (($cid) && ($cache = cache_get($cid, 'cache_block'))) {
    $array = $cache->data;
    dsm('from cache');
  }
  else {
    $array = module_invoke($module, 'block', 'view', $delta);
    dsm('not from cache');
  ...

I had a menu item with a callback which simply did the module_invoke and return the data.

function testpage() {
$block = module_invoke('blockcache_alter', 'block', 'view', 'views,RandomList-block_1');
return $block['content'];
}

Everything went fine, the first time (as a normal user) I got the 'not from cache' message, on reload the 'from cache' message and the cache_block table had following entry: views:RandomLijst-block_1: - [BLOB - 2,4 KB] , so I'm not sure what goes wrong with your code.

(Apart from that, the cid parts is empty, that might be another problem, but not related to this issue)

dropchew’s picture

Status: Active » Fixed

Hi swentel,

I just tried it again using your method and it works. Not sure why it doesn't work for me before. I notice also it will be cached whether or not if you went to block administration and put caching mode on. Thanks and sorry for taking your time.

Status: Fixed » Closed (fixed)

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