Go to the documentation of this file.00001 <?php
00010 final class cache {
00011
00017 private static $cfg;
00018
00022 private function __construct() {}
00023
00030 public static function getInstance(array $cfg = array()) {
00031 if (!self::$cfg)
00032 self::$cfg = new config(factory::loadCfg(__CLASS__));
00033 return factory::get('cache_'.self::$cfg->use, $cfg);
00034 }
00035
00045 public static function idRequest(array $prm = array()) {
00046 $tmp = '';
00047
00048 config::initTab($prm, array(
00049 'uri'=>true,
00050 'meth'=>array('get','post','session')
00051 ));
00052
00053 if ($prm['uri'] && !empty($_SERVER['REQUEST_URI']))
00054 $tmp.= $_SERVER['REQUEST_URI'];
00055
00056 ksort($prm['meth']);
00057 foreach($prm['meth'] as $m) {
00058 $vars = &$GLOBALS['_'.strtoupper($m)];
00059 if (!empty($vars)) {
00060 ksort($vars);
00061 $tmp.= '@'.$m.'=';
00062 foreach($vars as $k=>$v)
00063 $tmp.= $k.':'.$v.'&';
00064 }
00065 }
00066
00067 if (!empty($tmp))
00068 return sha1($tmp);
00069 else
00070 return '';
00071 }
00072
00073 }