Kevinrob\GuzzleCache\Storage\Psr6CacheStorage::save PHP Method

save() public method

public save ( $key, CacheEntry $data )
$data Kevinrob\GuzzleCache\CacheEntry
    public function save($key, CacheEntry $data)
    {
        if ($this->lastItem && $this->lastItem->getKey() == $key) {
            $item = $this->lastItem;
        } else {
            $item = $this->cachePool->getItem($key);
        }
        $this->lastItem = null;
        $item->set($data);
        $ttl = $data->getTTL();
        if ($ttl === 0) {
            // No expiration
            $item->expiresAfter(null);
        } else {
            $item->expiresAfter($ttl);
        }
        return $this->cachePool->save($item);
    }