Example #1
0
 public function testSetHit()
 {
     $this->item->setHit(true);
     $this->assertTrue($this->item->isHit());
     $this->item->setHit(false);
     $this->assertFalse($this->item->isHit());
 }
 /**
  * {@inheritdoc}
  */
 public function getItems(array $keys = array())
 {
     if ($this->deferred) {
         $this->commit();
     }
     $dataKeys = [];
     foreach ($keys as $key) {
         $dataKeys[] = $this->createKey($key);
     }
     $values = $this->getArrayDataFromStorage($dataKeys);
     $items = [];
     foreach ($keys as $key) {
         $item = new CacheItem($key, $this->ttl);
         $storageKey = $this->createKey($key);
         if (isset($values[$storageKey])) {
             $item->setHit(true);
             $item->set($values[$storageKey]);
         } else {
             $item->setHit(false);
         }
         $items[$key] = $item;
     }
     return $items;
 }