Пример #1
0
 public function defer($name, $params = array(), $callback = null)
 {
     if ($this->_redis === null) {
         $this->_connect();
     }
     if (empty($this->_queue)) {
         $this->_redis->multi(\Redis::PIPELINE);
     }
     $this->_queue[] = array('callback' => $callback, 'params' => $params);
     if ($this->_profiler) {
         $this->_profiler->log($name, $params);
     }
     return call_user_func_array(array($this->_redis, $name), $params);
 }
Пример #2
0
 public function InitProfiler()
 {
     // If timing parameter is set, force the profiler to be on
     $timing = any($this->request["args"]["timing"], $this->cfg->servers["profiler"]["level"], 0);
     if (!empty($this->cfg->servers["profiler"]["percent"])) {
         if (rand() % 100 < $this->cfg->servers["profiler"]["percent"]) {
             $timing = 4;
             Profiler::$log = true;
         }
     }
     if (!empty($timing)) {
         Profiler::$enabled = true;
         Profiler::setLevel($timing);
     }
 }
Пример #3
0
 /**
  * Destructor
  */
 public function __destruct()
 {
     // Optionally logs the destructor to the profiler
     if ($this->config['profiler']) {
         Profiler::log($this, '__destruct');
     }
 }