From: Aaron Schulz Date: Tue, 12 Mar 2019 09:49:59 +0000 (-0700) Subject: objectcache: make the BagOStuff::add() operation more atomic for APC X-Git-Tag: 1.34.0-rc.0~2516^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=1899a82c808bedf62d78037c6ff38e6c6c444fcb;p=lhc%2Fweb%2Fwiklou.git objectcache: make the BagOStuff::add() operation more atomic for APC Change-Id: Ifb72b1c17439c80e6d431d5fe2ec9ad9437e3ad7 --- diff --git a/includes/libs/objectcache/APCBagOStuff.php b/includes/libs/objectcache/APCBagOStuff.php index 1fedfaf616..847a1eb069 100644 --- a/includes/libs/objectcache/APCBagOStuff.php +++ b/includes/libs/objectcache/APCBagOStuff.php @@ -97,6 +97,14 @@ class APCBagOStuff extends BagOStuff { return true; } + public function add( $key, $value, $exptime = 0, $flags = 0 ) { + return apc_add( + $key . self::KEY_SUFFIX, + $this->setSerialize( $value ), + $exptime + ); + } + protected function setSerialize( $value ) { if ( !$this->nativeSerialize && !$this->isInteger( $value ) ) { $value = serialize( $value ); diff --git a/includes/libs/objectcache/APCUBagOStuff.php b/includes/libs/objectcache/APCUBagOStuff.php index fb43d4ddb3..d5f1edc163 100644 --- a/includes/libs/objectcache/APCUBagOStuff.php +++ b/includes/libs/objectcache/APCUBagOStuff.php @@ -55,6 +55,14 @@ class APCUBagOStuff extends APCBagOStuff { return true; } + public function add( $key, $value, $exptime = 0, $flags = 0 ) { + return apcu_add( + $key . self::KEY_SUFFIX, + $this->setSerialize( $value ), + $exptime + ); + } + public function delete( $key, $flags = 0 ) { apcu_delete( $key . self::KEY_SUFFIX );