MDL-47917 cachestore_memcached: fixed get_many ordering
authorSam Hemelryk <sam@moodle.com>
Mon, 3 Nov 2014 01:08:25 +0000 (14:08 +1300)
committerSam Hemelryk <sam@moodle.com>
Mon, 3 Nov 2014 01:08:25 +0000 (14:08 +1300)
cache/stores/memcached/lib.php

index f75d8c5..25a7d5a 100644 (file)
@@ -302,16 +302,19 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
      *      be set to false.
      */
     public function get_many($keys) {
+        $return = array();
         $result = $this->connection->getMulti($keys);
         if (!is_array($result)) {
             $result = array();
         }
         foreach ($keys as $key) {
             if (!array_key_exists($key, $result)) {
-                $result[$key] = false;
+                $return[$key] = false;
+            } else {
+                $return[$key] = $result[$key];
             }
         }
-        return $result;
+        return $return;
     }
 
     /**