Download & Extend

Block cache setting when proving tags as blocks

Project:DART
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I recently realized that I was unable to use block caching while exporting my DART tags as blocks. This is because they were cached globally, which interfered with the tags getting their appropriate tags and zones.

The attached patch allows you to set a block caching level on a tag-by-tag basis.

AttachmentSize
dart-block-cache-setting.patch3.37 KB

Comments

#1

(quick note: whenever you submit a patch, you should always mark the issue as "needs review")

I'm not sure about adding this option directly to the DART module. The configuration forms are already pretty complicated. This isn't a definite no but I want to think about it for a bit. In the mean time I recommend you take a look here: http://drupal.org/project/blockcache_alter. It's well maintained and should solve your problem.

#2

Yeah, understandable. I tried to make it as "clean" as possible by making the cache setting a hidden dependent.

I think blockcache_alter could be helpful, and I'll definitely investigate but I see it currently doesn't work with Drupal core. That would be my general fear of using a module to support the cache setting post-hoc; it's not an approach to caching that seems particularly well supported in D6.

Setting these things in the generating modules directly doesn't totally make sense to me, but it does seem like the safest approach.

Anyway, thanks for the reply. Let me know how you decide to proceed.

#3

I was testing some code today and found that DART was adding about 12 queries per page. This was true even if block caching is enabled, which led me to this issue. The change to make block caching makes a lot of sense as otherwise DART will not function correctly when block caching is enabled. I'm also wondering if further caching is needed for the key/value pairs for a given page? Is it dart_taxonomy and context that is causing the extra queries even if block caching is enabled? Specifically devel reports 6 queries from dart_taxonomy_map_get() and 6 queries from taxonomy_get_parents().

Perhaps the first step is getting block caching fixed with the patch provided here, followed a look into caching any remaining queries that occur when block caching is enabled.

#4

rickvug ... lets just focus on the block caching in here for now. In the mean time, have you tried the patch in the original post? Can you give a quick kick of the tires and if it helps with the performance, then I will definitly take another look.

#5

@bleen18 I haven't tried the original post as it is for D6 and I'm running D7.

That said the problem is that the default cache setting for blocks is DRUPAL_CACHE_PER_ROLE. As mshick stated in the first post, DART block's variables aren't changing from page to page with block caching enabled. Setting the block cache to DRUPAL_CACHE_PER_PAGE would solve the problem. I don't know if the role based cache is needed as well (DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE). Under what circumstances would the ad tag differ between roles? Either way a solution could be a single line if the configuration in the exportable is removed. If you can see cases where a site would want to fine tune caching per block then the approach in this patch is the way to go. Any way that you solve the problem performance won't be improved (there will actually be less block caching).

#6

Status:patch (to be ported)» fixed

for the time being I have committed this patch to 7.x-2.x and a similar one to 6.x-2.x

I think this is the correct block caching for 99% of use-cases.

AttachmentSize
1426436.patch 424 bytes

#7

Looks good to me. Thanks for being so quick to fix the issue.

#8

Status:fixed» closed (fixed)

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

nobody click here