Stash\Pool::save PHP Method

save() public method

public save ( Psr\Cache\CacheItemInterface $item )
$item Psr\Cache\CacheItemInterface
    public function save(CacheItemInterface $item)
    {
        return $item->save();
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @return AircraftCollection
  */
 public function getAllAircraft()
 {
     if ($this->cacheEnabled) {
         $cacheItem = $this->cachePool->getItem('aircraftCollection');
         $aircraftCollection = $cacheItem->get();
         if ($cacheItem->isHit()) {
             return $aircraftCollection;
         }
     }
     $fileObjects = $this->recursiveIterator;
     $aircraftCollection = $this->aircraftCollection;
     foreach ($fileObjects as $file) {
         if ($file->getFilename() === 'aircraft.json') {
             $json = file_get_contents($file->getPathName());
             if ($json) {
                 $aircraftConfig = json_decode($json);
                 $aircraftConfig->path = $file->getPath();
                 $aircraftCollection->push($aircraftConfig);
             }
         }
     }
     if ($this->cacheEnabled) {
         $this->cachePool->save($cacheItem->set($aircraftCollection));
     }
     return $aircraftCollection;
 }
All Usage Examples Of Stash\Pool::save