26 parent::__construct($root,
$postfix);
27 $this->_fileMode=(isset($cacheParams[
"fileMode"])) ? $cacheParams[
"fileMode"] : 0777;
29 \mkdir($root, $this->_fileMode,
true);
38 return file_exists($this->
_getPath($key));
49 if (@\file_put_contents($path, $content, LOCK_EX) ===
false) {
50 throw new \Exception(
"Unable to write cache file: {$path}");
52 if (@\chmod($path, $this->_fileMode) ===
false) {
53 throw new \Exception(
"Unable to set permissions of cache file: {$path}");
63 return include ($this->
_getPath($key));
72 return \file_get_contents($this->
_getPath($key));
82 return \filemtime($this->
_getPath($key));
92 return $this->_root . DIRECTORY_SEPARATOR . $key . $this->postfix .
'.php';
100 public function remove($key) {
102 if (\file_exists($file))
103 return \unlink($file);
112 public function clear($matches=
"") {
113 $files=glob($this->_root .
'/' . $matches .
'*');
114 foreach ( $files as $file ) {
127 $file=\basename($file);
128 return $type .
"/" . substr($file, 0, strpos($file, $this->postfix .
'.php'));
147 $result=parent::getCacheInfo();
fetch($key)
Fetches data stored for the given key.
getTimestamp($key)
Returns the timestamp of the last cache update for the given key.
Inspired by (c) Rasmus Schultz rasmus@mindplay.dk https://github.com/mindplay-dk/php-annotations ...
storeContent($key, $content, $tag)
Caches the given data with the given key.
static cleanPathname($path)
This class is responsible for storing Arrays in PHP files.
This class is responsible for storing Arrays in PHP files.
__construct($root, $postfix="", $cacheParams=[])
Initializes the file cache-provider.
exists($key)
Check if annotation-data for the key has been stored.
static getCacheDirectory()
file_get_contents($key)
return data stored for the given key.
_getPath($key)
Maps a cache-key to the absolute path of a PHP file.
static initFromFiles($folder, $type, $keyFunction=null)