Commit 071fe0b6 authored by Berdir's avatar Berdir Committed by Jeremy

Issue #1896452 by markpavlitski, Berdir, codycraven, Jeremy: Active memcache...

Issue #1896452 by markpavlitski, Berdir, codycraven, Jeremy: Active memcache more than doubles cache clear/menu rebuild time
parent 3c198cf3
......@@ -614,9 +614,14 @@ class MemCacheDrupal implements DrupalCacheInterface {
public function variable_set($name, $value) {
global $conf;
// If the value appears unchanged, do nothing.
if (isset($conf[$name]) && $conf[$name] === $value) {
return;
}
// When lots of writes happen in a short period of time db_merge can throw
// errors. This should only happen if another request has written the variable
// first, so we catch the error to prevent a fatal error.
// errors. This should only happen if another request has written the
// variable first, so we catch the error to prevent a fatal error.
try {
db_merge('variable')
->key(array('name' => $name))
......@@ -624,8 +629,8 @@ class MemCacheDrupal implements DrupalCacheInterface {
->execute();
}
catch (Exception $e) {
// We can safely ignore the error, since it's likely a cache flush timestamp
// which should still be accurate.
// We can safely ignore the error, since it's likely a cache flush
// timestamp which should still be accurate.
}
// If the variables are cached, get a fresh copy, update with the new value
......
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