/**
  * Creates new CacheResponse object from given CacheElement.
  *
  * @param CacheElement $element
  * @param null $status Value for X-Supercache header. By default null (no header will be added).
  *
  * @return static
  */
 public static function createFromElement(CacheElement $element, $status = null)
 {
     $mime = self::getMimeByType($element->getType());
     $headers = array('Content-Type' => $mime);
     if ($status !== null) {
         $headers['X-Supercache'] = $status;
     }
     return new static($element->getContent(), static::HTTP_OK, $headers);
 }
 /**
  * Saves entry content. If entry exists it will be updated, otherwise created.
  *
  * @param CacheElement $element
  *
  * @return bool
  * @throws FilesystemException
  * @throws SecurityViolationException Specified cache path was found to be dangerous (eg. /../../sandbox)
  */
 public function saveElement(CacheElement $element)
 {
     $path = $element->getPath() . '/index.' . $element->getType();
     //Type contains extension
     return $this->finder->writeFile($path, $element->getContent());
 }