MkFramework
 All Data Structures Functions
class_cache.php
1 <?php
2 /*
3 This file is part of Mkframework.
4 
5 Mkframework is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License.
8 
9 Mkframework is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mkframework. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
23 class _cache{
24 
32  public function isCached($sId,$iMinute=null){
33  $oFile=new _file(_root::getConfigVar('path.cache').$sId.'.cache');
34  if($oFile->exist()){
35  if($iMinute==null){
36  return true;
37  }else if( (time()-$oFile->filemtime()) < ($iMinute*60)){
38  return true;
39  }
40  return false;
41  }
42  return false;
43  }
50  public function getCached($sId){
51  $oView=new _view(_root::getConfigVar('path.cache').$sId.'.cache');
52  return $oView;
53  }
60  public function setCache($sId,$oView){
61  $oFile=new _file(_root::getConfigVar('path.cache').$sId.'.cache');
62  $oFile->setContent($oView->show() );
63  $oFile->save();
64  }
70  public function clearCache($sId){
71  $oFile=new _file(_root::getConfigVar('path.cache').$sId.'.cache');
72  $oFile->delete();
73  }
74 
75 
76 
77 }
getCached($sId)
Definition: class_cache.php:50
static getConfigVar($sCatAndVar, $uDefaut=null)
Definition: class_root.php:654
isCached($sId, $iMinute=null)
Definition: class_cache.php:32
setCache($sId, $oView)
Definition: class_cache.php:60
clearCache($sId)
Definition: class_cache.php:70