diff options
author | Robin Appelman <robin@icewind.nl> | 2024-07-10 22:32:47 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-08-07 19:41:43 +0200 |
commit | b19652a2add61d652e0e8385c44de942eee611a1 (patch) | |
tree | 72b6c3b26ca1e2a8512ad31a7734f14b2ab104bc /lib | |
parent | 4691d197707e84173800c5c225d5395fee53db17 (diff) | |
download | nextcloud-server-b19652a2add61d652e0e8385c44de942eee611a1.tar.gz nextcloud-server-b19652a2add61d652e0e8385c44de942eee611a1.zip |
chore: cleanup acpu inc and dec
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Memcache/APCu.php | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php index 9eb2ee0b2bf..024462d227b 100644 --- a/lib/private/Memcache/APCu.php +++ b/lib/private/Memcache/APCu.php @@ -73,22 +73,8 @@ class APCu extends Cache implements IMemcache { * @return int | bool */ public function inc($key, $step = 1) { - $this->add($key, 0); - /** - * TODO - hack around a PHP 7 specific issue in APCu - * - * on PHP 7 the apcu_inc method on a non-existing object will increment - * "0" and result in "1" as value - therefore we check for existence - * first - * - * on PHP 5.6 this is not the case - * - * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 - * for details - */ - return apcu_exists($this->getPrefix() . $key) - ? apcu_inc($this->getPrefix() . $key, $step) - : false; + $success = null; + return apcu_inc($this->getPrefix() . $key, $step, $success, self::DEFAULT_TTL); } /** @@ -99,18 +85,6 @@ class APCu extends Cache implements IMemcache { * @return int | bool */ public function dec($key, $step = 1) { - /** - * TODO - hack around a PHP 7 specific issue in APCu - * - * on PHP 7 the apcu_dec method on a non-existing object will decrement - * "0" and result in "-1" as value - therefore we check for existence - * first - * - * on PHP 5.6 this is not the case - * - * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221 - * for details - */ return apcu_exists($this->getPrefix() . $key) ? apcu_dec($this->getPrefix() . $key, $step) : false; |