27 parent::__construct($root,
$postfix);
28 $this->_fileMode=(isset($cacheParams[
"fileMode"])) ? $cacheParams[
"fileMode"] : 0777;
30 \mkdir($root, $this->_fileMode,
true);
39 return file_exists($this->
_getPath($key));
50 if (@\file_put_contents($path, $content, LOCK_EX) ===
false) {
53 if (@\chmod($path, $this->_fileMode) ===
false) {
54 throw new CacheException(
"Unable to set permissions of cache file: {$path}");
64 return include ($this->
_getPath($key));
73 return \file_get_contents($this->
_getPath($key));
83 return \filemtime($this->
_getPath($key));
93 return $this->_root . DIRECTORY_SEPARATOR . $key . $this->postfix .
'.php';
101 public function remove($key) {
103 if (\file_exists($file))
104 return \unlink($file);
113 public function clear($matches=
"") {
114 $files=glob($this->_root .
'/' . $matches .
'*');
115 foreach ( $files as $file ) {
128 $file=\basename($file);
129 return $type .
"/" . substr($file, 0, strpos($file, $this->postfix .
'.php'));
148 $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 cleanFilePathname($path)
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)