Closed (fixed)
Project:
Cache Backport (D7 to D6)
Version:
6.x-1.0-beta2
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Oct 2011 at 09:25 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tobiassjosten commentedHere is a patch that fixes this problem.
Comment #2
pounardThanks a lot for issuing!
This patch looks good, except that the $headers parameter is ignored by the DrupalCacheInterface::set() method: this problem is due to the radical change of caching API between D6 and D7.
Your patch does not fixes entirely the problem, we have to find a deeper solution: let's start by looking a bit deeper into how cache backends handles their data. Any help/suggestion is welcome!
Comment #3
tobiassjosten commentedYou are right, the headers parameter is gone in D7. I wonder how it is used now and, if at all, how it could be used with Cache Backport.
These cache backends follows suit on the interface:
Filecache
Redis/PhpRedis
Redis 2.x/PhpRedis
These does not:
Memcache
APC
The problem really is with the implementation in the last two, since the interface is pretty clear about its signature.
So let's see how and if cache headers are used nowadays. I'll be able to look into this again in a couple of days.
Comment #4
pounardThanks again for feedback, ll wait to ear from you then. If I accidentaly (ahah) end up with some spare time, I will do some research on my side, I cant do no promise for the future 2 weeks.
Comment #5
Peter Bowey commentedWith the current Cache Backport (D7 to D6) cache.inc
method I have the issue of seeing these PHP warning notices:
Via Pressflow: 6.22
The code affecting this 'warning' is from D6 Core [Pressflow] bootstrap.inc:
Therefore, I conclude that cache.inc (via Cache Backport) should be changed:
Thus, I agree with the above patch: -> http://drupal.org/files/cache_set_headers_parameter-1297754-1.patch
Also note that 'drupal_apc_cache.inc' steps out of the D6 $headers API level,
and uses:
I understand the second line (above) is correct for D6.
Comment #6
Peter Bowey commentedSorry!
Posted twice :-)
Slow Server
Comment #7
pounardHo thanks for the detailed report, I will take some time to see this as soon as possible. Could you provide a patch that does not implies patching the cache backends?
EDIT: Just saw it, let me have a look.
Comment #8
pounardThe problem is that D7 API doesn't seem to care at all about headers. The only solution I see in order to be able to handle them correctly without changing the interface signature is that if $headers is present, then I wrap the cache into a specific object that carries the headers with it, on cache_set(), and at cache_get() time I check if I have a wrapper object, is so I rebuild the correct cache object with the headers property. Should work.
Comment #9
pounard@peter bowey
Does the attached patch fixes you problem?
Comment #10
pounardAfter some testing, I decided to push it as-is, it does not creates any regression over my environment and I don't get the headers warnings anymore.
Re-open if the new 6.x-1.0-rc1 release does not fix the problem.
Thanks to both of you!
Comment #11
Peter Bowey commentedRefer #10
Many thanks pounard for your latest work,
I have just installed and tested Cache Backport 6.x-1.0-rc1.
My previous noted issue with the PHP warning notices - no longer occurs.
I am still testing heavily, but no [zero] problems to report at this moment!
Well done!
Comment #12
Peter Bowey commented@ Refer #10
After testing 'new 6.x-1.0-rc1' over-night,
I find that the APC "Cached Variables"
show a statistic drop in hits of about 50%.
Moving back to the pre-6.x-1.0-rc1 release, with
older [patch] methods (refer #5). (just to get to stats for comparison)
Comment #13
Peter Bowey commented@ #12
Reverting to older code +patch (refer #5) gave these results,
(after a few minutes testing):
The # of cached variables is higher than before (refer #10)
The test in #10 was over-night,
the test here (#13) was over a few minutes.
Comment #14
pounardHow should I interpret those figures?
Remember that the $headers parameter is not part of the Drupal 7 DrupalCacheInterface interface, APC implementation is wrongly using it, so #5 patch is not acceptable because it will just make $headers being dropped by most backends.