Example #1
0
 public function testSet()
 {
     $this->item->set('some value');
     $this->assertEquals('some value', $this->item->get());
 }
 /**
  * {@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;
 }