public function FilesystemCache::set

Sets a value in the cache.

Parameters

string $key A unique key:

string $value The value to cache:

Overrides CacheInterface::set

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Cache/FilesystemCache.php, line 44

Class

FilesystemCache
A simple filesystem cache.

Namespace

Assetic\Cache

Code

public function set($key, $value) {
  if (!is_dir($this->dir) && false === @mkdir($this->dir, 0777, true)) {
    throw new \RuntimeException('Unable to create directory ' . $this->dir);
  }
  $path = $this->dir . '/' . $key;
  if (false === @file_put_contents($path, $value)) {
    throw new \RuntimeException('Unable to write file ' . $path);
  }
}