nyroFwk  0.2
cache.class.php
Go to the documentation of this file.
1 <?php
10 final class cache {
11 
17  private static $cfg;
18 
22  private function __construct() {}
23 
30  public static function getInstance(array $cfg = array()) {
31  if (!self::$cfg)
32  self::$cfg = new config(factory::loadCfg(__CLASS__));
33  return factory::get('cache_'.self::$cfg->use, $cfg);
34  }
35 
45  public static function idRequest(array $prm = array()) {
46  $tmp = '';
47 
48  config::initTab($prm, array(
49  'uri'=>true,
50  'meth'=>array('get','post','session')
51  ));
52 
53  if ($prm['uri'] && !empty($_SERVER['REQUEST_URI']))
54  $tmp.= $_SERVER['REQUEST_URI'];
55 
56  ksort($prm['meth']);
57  foreach($prm['meth'] as $m) {
58  $vars = &$GLOBALS['_'.strtoupper($m)];
59  if (!empty($vars)) {
60  ksort($vars);
61  $tmp.= '@'.$m.'=';
62  foreach($vars as $k=>$v)
63  $tmp.= $k.':'.$v.'&';
64  }
65  }
66 
67  if (!empty($tmp))
68  return sha1($tmp);
69  else
70  return '';
71  }
72 
73 }
static getInstance(array $cfg=array())
Definition: cache.class.php:30
static idRequest(array $prm=array())
Definition: cache.class.php:45
static initTab(array &$vars, array $init)
static $cfg
Definition: cache.class.php:17
static loadCfg($className, $searchParent=true)
__construct()
Definition: cache.class.php:22
static get($className, array $cfg=array())
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13