41 return 'cache_' . md5($id) .
'.' . md5($group);
51 public function get($id, $group=
'default')
54 $this->_group = $group;
57 if (file_exists($filename)) {
58 $fh = fopen($filename,
'r');
60 $lifetime = trim(fgets($fh));
61 if ($lifetime ==
'undefined' || $lifetime >= time()) {
62 $data = stream_get_contents($fh);
82 public function save($value, $lifetime=null, $id=
false, $group=
'default')
90 $lifetime = strtotime($lifetime);
92 $lifetime =
'undefined';
95 return file_put_contents(
APP_PATH .
'temp/cache/' . $this->
_getFilename($id, $group),
"$lifetime\n$value");
106 $pattern = $group ?
APP_PATH .
'temp/cache/' .
'*.' . md5($group) :
APP_PATH .
'temp/cache/*';
107 foreach (glob($pattern) as $filename) {
108 if (!unlink($filename)) {
122 public function remove($id, $group=
'default')