You are here

protected function FilesystemCache::doSave in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php \Doctrine\Common\Cache\FilesystemCache::doSave()

Puts data into the cache.

Parameters

string $id The cache id.:

string $data The cache entry/data.:

int $lifeTime The lifetime. If != 0, sets a specific lifetime for this: cache entry (0 => infinite lifeTime).

Return value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

Overrides CacheProvider::doSave

File

vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php, line 100

Class

FilesystemCache
Filesystem cache driver.

Namespace

Doctrine\Common\Cache

Code

protected function doSave($id, $data, $lifeTime = 0) {
  if ($lifeTime > 0) {
    $lifeTime = time() + $lifeTime;
  }
  $data = serialize($data);
  $filename = $this
    ->getFilename($id);
  return $this
    ->writeFile($filename, $lifeTime . PHP_EOL . $data);
}