53 public function get(&$value, array $prm) {
56 'ttl'=>$this->cfg->ttl,
58 'tags'=>$this->cfg->tags,
59 'request'=>$this->cfg->request,
60 'serialize'=>$this->cfg->serialize
62 $prm[
'value'] = &$value;
63 $prm[
'file'] = $this->
file(array_merge($prm,
68 if ($prm[
'ttl'] == 0 || $date + $prm[
'ttl'] * 60 > time()) {
69 if ($prm[
'serialize'])
70 $value = unserialize(
file::read($prm[
'file']));
72 eval(
'$value = '.
file::read($prm[
'file']).
';');
89 if (!empty($this->prmVar))
90 if ($this->prmVar[
'serialize'])
91 $ret =
file::write($this->prmVar[
'file'], serialize($this->prmVar[
'value']));
93 $ret =
file::write($this->prmVar[
'file'], var_export($this->prmVar[
'value'],
true));
118 'ttl'=>$this->cfg->ttl,
120 'tags'=>$this->cfg->tags,
121 'request'=>$this->cfg->request
123 $prm[
'file'] = $this->
file(array_merge($prm,
127 file::date($prm[
'file']) + $prm[
'ttl'] * 60 > time())) {
139 $this->prmOut = $prm;
154 if (!empty($this->prmOut)) {
155 $content = ob_get_contents();
158 echo $this->obSave.$content;
162 $ret =
file::write($this->prmOut[
'file'], $content);
164 $this->prmOut = null;
181 public function delete(array $prm = array()) {
187 'request'=>array(
'uri'=>
false,
'meth'=>array())
189 $file = $this->
file($prm);
190 $file{strlen($file)-1} =
'*';
191 if (!empty($prm[
'tags'])) {
192 for($i = 0; $i<count($prm[
'tags']); $i++) {
193 $file = str_replace(
','.$prm[
'tags'][$i].
',',
'*,'.$prm[
'tags'][$i].
',', $file);
196 $files = glob($file);
198 foreach($files as
$f)
240 private function file(array $prm) {
241 $prm = array_merge(array(
248 if (!empty($prm[
'tags'])) {
250 $prm[
'tagsS'] =
',_,'.implode(
',_,', $prm[
'tags']).
',_,';
252 $fileA = array_merge($this->cfg->startFile, array(
260 array(
'-REQUEST::LANG-',
'-REQUEST::OUT-'),
262 $this->cfg->path.implode(
'^', $fileA).
'.cache');
static callFrom($nb=1, $sep='-')
static initTab(array &$vars, array $init)
static write($file, $content)