40 public function has($resource)
51 public function set($resource, $value)
55 if (!is_dir(
$dir = dirname(
$path)) &&
false === @mkdir(
$dir, 0777,
true)) {
57 throw new \RuntimeException(
'Unable to create directory '.
$dir);
61 if (
false === @file_put_contents(
$path, sprintf(
"<?php\n\n// $resource\nreturn %s;\n", var_export($value,
true)))) {
63 throw new \RuntimeException(
'Unable to write file '.
$path);
75 public function get($resource)
79 if (!file_exists(
$path)) {
80 throw new \RuntimeException(
'There is no cached value for '.$resource);
97 if (!file_exists(
$path)) {
98 throw new \RuntimeException(
'There is no cached value for '.$resource);
101 if (
false === $mtime = @filemtime(
$path)) {
103 throw new \RuntimeException(
'Unable to determine file mtime for '.
$path);
119 $key = md5($resource);
121 return $this->dir.
'/'.$key[0].
'/'.$key.
'.php';
has($resource)
Checks of the cache has a file.
getSourcePath($resource)
Returns the path where the file corresponding to the supplied cache key can be included from...
getTimestamp($resource)
Returns a timestamp for when the cache was created.
A config cache stores values using var_export() and include.
__construct($dir)
Construct.