mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 17:54:55 +02:00
* add @method annotations to Cache class
* code beautify
This commit is contained in:
@@ -42,8 +42,9 @@ class Cache_PHP
|
||||
public function get($key)
|
||||
{
|
||||
$tmp = '';
|
||||
if($this->fetch($key, $tmp))
|
||||
if($this->fetch($key, $tmp)) {
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -51,8 +52,9 @@ class Cache_PHP
|
||||
public function fetch($key, &$var)
|
||||
{
|
||||
$file = $this->_name($key);
|
||||
if(!file_exists($file) || filemtime($file) < time())
|
||||
if(!file_exists($file) || filemtime($file) < time()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@include $file;
|
||||
$var = isset($var) ? $var : null;
|
||||
@@ -62,8 +64,9 @@ class Cache_PHP
|
||||
public function delete($key)
|
||||
{
|
||||
$file = $this->_name($key);
|
||||
if(file_exists($file))
|
||||
if(file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
public function enabled() {
|
||||
@@ -73,5 +76,4 @@ class Cache_PHP
|
||||
private function _name($key) {
|
||||
return sprintf('%s%s%s', $this->dir, $this->prefix, sha1($key) . '.php');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
Reference in New Issue
Block a user