Beispiel #1
0
 public function testMultiSetAndGetTtl()
 {
     $data = ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];
     $keys = array_keys($data);
     $this->assertEquals(3, $this->cache->mset($data, 10));
     $this->assertEquals($data, $this->cache->mget($keys));
 }
 /**
  * {@inheritdoc}
  */
 public function mget(array $keys)
 {
     $result = [];
     foreach ($keys as $index => $key) {
         if (!isset($this->hot[$key])) {
             continue;
         }
         $result[$key] = $this->hot[$key];
         unset($keys[$index]);
     }
     if (count($keys) > 0) {
         $cacheResult = $this->cache->mget(array_values($keys));
         foreach ($cacheResult as $key => $value) {
             $result[$key] = $this->hot[$key] = $value;
         }
     }
     return $result;
 }