private function Store::save

Save data for the given key.

Parameters

string $key The store key:

string $data The data to store:

Return value

Boolean

2 calls to Store::save()
Store::invalidate in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php
Invalidates all cache entries that match the request.
Store::write in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php
Writes a cache entry to the store for the given Request and Response.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php, line 337

Class

Store
Store implements all the logic for storing cache metadata (Request and Response headers).

Namespace

Symfony\Component\HttpKernel\HttpCache

Code

private function save($key, $data) {
  $path = $this
    ->getPath($key);
  if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) {
    return false;
  }
  $tmpFile = tempnam(dirname($path), basename($path));
  if (false === ($fp = @fopen($tmpFile, 'wb'))) {
    return false;
  }
  @fwrite($fp, $data);
  @fclose($fp);
  if ($data != file_get_contents($tmpFile)) {
    return false;
  }
  if (false === @rename($tmpFile, $path)) {
    return false;
  }
  @chmod($path, 0666 & ~umask());
}