/**
  * @Route /performance/list
  */
 public function listAction()
 {
     $cache = new \Raptor\Cache\Cache('performance');
     if ($cache->hasCache()) {
         $performance = $cache->getData();
     } else {
         $performance = new ItemList();
     }
     $series = array();
     $performance->each(function ($key, $value) use(&$series) {
         $item = new ItemList();
         $item->set('value', $value);
         $item->set('no', $key);
         $series[] = $item->getArray();
     });
     return $this->JSON(new ItemList($series));
 }
示例#2
0
 public function registerLastPerformance()
 {
     $app = \Raptor\Raptor::getInstance();
     $time = round($app->getTimer()->getExecutionTime(), 2);
     $cache = new \Raptor\Cache\Cache('performance');
     if (!$cache->hasCache()) {
         $performance = new \Raptor\Util\ItemList();
     } else {
         $performance = $cache->getData();
     }
     if ($performance->size() < 20) {
         $performance->add($time);
     } else {
         $performance->shift();
         $performance->add($time);
     }
     $cache->setData($performance);
     $cache->save();
 }
 /**
  * 
  * Fuerza al cargador a re-leer la configuracion
  * and cached
  */
 public function forceLoad()
 {
     $this->cache->setDirty();
     $this->read();
 }
示例#4
0
 /**
  * Retorna el Manejador de API de Raptor, esta debe devolver toda la documentacion declarada en Raptor.
  * 
  * @return boolean
  */
 public function getApi()
 {
     $api = new \Raptor\Cache\Cache('api');
     if ($api->isDirty()) {
         return false;
     } else {
         return $api->getData();
     }
 }