You are here

private function Store::save in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/HttpCache/Store.php \Symfony\Component\HttpKernel\HttpCache\Store::save()

Save data for the given key.

Parameters

string $key The store key:

string $data The data to store:

Return value

bool

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

File

vendor/symfony/http-kernel/HttpCache/Store.php, line 338

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());
}