Cache: Make APCUBagOStuff::set return a useful value
authorDaimona Eaytoy <daimona.wiki@gmail.com>
Sun, 14 Apr 2019 17:13:48 +0000 (19:13 +0200)
committerDaimona Eaytoy <daimona.wiki@gmail.com>
Sun, 14 Apr 2019 17:13:48 +0000 (19:13 +0200)
It took me lots of time to debug a CI failure in
I9b3bc36b552901bc6ca7609ee51e80be2979a9c4. I was deceived by
$cache->set returning true, which according to the docs means that the
store was successful. But instead, this function just returns true, even
in case of failure. Make it return the result of apcu_store, which is
already in the format true = success, false = failure.

Change-Id: I2619845c12460e1acb5af696d2c11a5a4dee1bd3

includes/libs/objectcache/APCUBagOStuff.php

index 0483ee7..ed4eb35 100644 (file)
@@ -54,13 +54,11 @@ class APCUBagOStuff extends BagOStuff {
        }
 
        public function set( $key, $value, $exptime = 0, $flags = 0 ) {
-               apcu_store(
+               return apcu_store(
                        $key . self::KEY_SUFFIX,
                        $this->serialize( $value ),
                        $exptime
                );
-
-               return true;
        }
 
        public function add( $key, $value, $exptime = 0, $flags = 0 ) {