Cache Per Page...

nicholasThompson - October 12, 2009 - 10:45
Project:AdSense
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I had a slight issue on my blog (www.thingy-ma-jig.co.uk) where the managed adsense module was using the default block cache of "per role". This means that if the block got generated on a page where I'd (accidentally) already aassigned 3 blocks in the content then the block would not render (correct behaviour). Unfortunately, this cached block would then also return black for every other page until it's cache expired.

By changing the cache to be "per page", the problem went away.

I'd love to see this in the next version please. Either changed in the code or - if you wanna show off - give the option per-block ;-)

#1

jcnventura - October 12, 2009 - 13:35
Status:needs work» active

Hi,

Thanks for bringing this to my attention. This might actually be better as "no cache", to make sure that revenue-sharing enabled blocks really rotate on every new page view..

I will commit a patch for this once I decide on whether to make it per-page or no cache, so it will be for sure in the next version.

João

#2

nicholasThompson - October 13, 2009 - 08:29

Good point about the revenue sharing. I'd not considered that...

I'm not sure which I'd go for. On one hand, adding a config setting to allow the site admin to set per-page or none would be pretty handy, however... The overhead for generating the form, looking up the setting, blah blah could counteract any performance gain.

On the flip side, per-page would force the content to be a database hit (cache_get()) whereas no-cache should (I believe) simply be a variable_get() (which I believe is no extra database hit) and an echo (essentially). Could it be possible that, in this case, caching is slower than no cache? I mean its not like you have to do any complicated work on output of a block, is it?

 
 

Drupal is a registered trademark of Dries Buytaert.