Commit 52731350 authored by catch's avatar catch

Issue #1150072 by catch: Review expires handling.

parent 91af33a8
......@@ -138,11 +138,14 @@ class MemCacheDrupal implements DrupalCacheInterface {
$cache->expire = $expire;
}
// We manually track the expire time in $cache->expire. When the object
// expires, we only allow one request to rebuild it to avoid cache
// stampedes. Other requests for the expired object while it is still being
// rebuilt get the expired object.
dmemcache_set($cid, $cache, 0, $this->bin, $this->memcache);
// Manually track the expire time in $cache->expire. When the object
// expires, if stampede protection is enabled, it may be served while one
// process rebuilds it. The ttl sent to memcache is set to the expire twice
// as long into the future, this allows old items to be expired by memcache
// rather than evicted along with a sufficient period for stampede
// protection to continue to work.
$memcache_expire = $cache->expire + (($cache->expire - REQUEST_TIME) * 2);
dmemcache_set($cid, $cache, $memcache_expire, $this->bin, $this->memcache);
}
function clear($cid = NULL, $wildcard = FALSE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment