Closed (fixed)
Project:
Memcache API and Integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 May 2011 at 12:45 UTC
Updated:
10 Jul 2020 at 13:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
catchThis was a false alarm, while dmemcache.inc used to handle the expiry and stampede protection logic and this was moved into memcache.inc, only memcache.inc actually abuses the expires value - lock and sessions just set it as you'd expect. So it was fine both ways.
One thing I'm wondering, instead of CACHE_PERMANENT, could we do $expire * 2 - this would mean that items get a decent window for stampede protection, but if they actually do expire for a while, memcache could replace them instead of having to do evictions - this might increase overall hit rate, and would also mean there's a limit on how stale the items we serve from stampede protection are. I don't think this is worth putting into 1.9 though, so downgrading this and not posting a patch. If we wanted to do this we'd probably also want to shorten the lifetime for CACHE_TEMPORARY (say to 24 or 72 hours - it's currently a month - that might need to be a variable if we did that though).
Comment #2
catchHere's a patch.
Comment #3
catchComment #4
catchAnd for D7.
Comment #5
catchD6 doesn't have the REQUEST_TIME constant.
Comment #6
catchOK I've tested this locally and it's working fine, so I've committed/pushed to both branches.
Comment #8
jeremy commentedIn the event that expire is CACHE_PERMANENT, it appears you'll end up setting the expire to a large negative number (and it's unclear to me how what memcache set does with that).
Perhaps should instead do something like (thanks Bdragon):
Comment #9
jeffsheltren commentedHere are some patches for 6.x and 7.x which do the same thing as Jeremy suggested, though I more explicitly check that $cache->expire is set to CACHE_PERMANENT instead of relying on the fact that CACHE_PERMANENT happens to be 0.
Comment #10
catchThanks for this, committed to both branches.
Looking at this again, I noticed we're also increasing the length of CACHE_TEMPORARY items which isn't really the intention, so moving this back to active for that. That won't really do any harm since they get invalidated very, very often anyway but wasn't supposed to change here.
Comment #11
jeremy commentedthis logic was completely rewritten in the past eight (!) years -- this issue is no longer valid, closing