Exemple #1
0
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // Kiem tra neu chua dang nhap thi bo qua
     $identity = Digitalus_Auth::getIdentity();
     if (!$identity) {
         return;
     }
     ////////////////////////////////////////
     //    	$this->_cache = ZendX_Cache_Manager::getInstance();
     $this->_cache = Digitalus_Cache_Manager::getInstance();
     // La la cac phuong thuc khac get() no se khong lay tu content tu cache ra
     if (!$request->isGet()) {
         self::$doNotCache = true;
         return;
     }
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $path = $request->getPathInfo();
     // co loi o day , xem link de biet cach sua
     $this->_key = md5($path);
     $this->_keyTags = array($module, "{$module}_{$controller}", "{$module}_{$controller}_{$action}");
     if (false !== ($data = $this->getCache())) {
         $response = $this->getResponse();
         $response->setBody($data['default']);
         $response->sendResponse();
         exit;
     }
 }
Exemple #2
0
 /**
  * Start caching
  *
  * Determine if we have a cache hit. If so, return the response; else,
  * start caching.
  * 
  * @param  Zend_Controller_Request_Abstract $request 
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     //    	echo "<pre>";
     //    	print_r($request->getRequestUri());
     //    	echo "</pre>";
     //    	exit();
     if (!$request->isGet()) {
         self::$doNotCache = true;
         return;
     }
     $path = $request->getPathInfo();
     // co loi o day , xem link de biet cach sua
     $this->_key = md5($path);
     if (false !== ($response = $this->getCache())) {
         $response->sendResponse();
         exit;
     }
 }
Exemple #3
0
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $this->_cache = Zend_Registry::get('cache');
     // La la cac phuong thuc khac get() no se khong lay tu content tu cache ra
     if (!$request->isGet()) {
         self::$doNotCache = true;
         return;
     }
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $path = $request->getPathInfo();
     // co loi o day , xem link de biet cach sua
     $this->_key = md5($path);
     $this->_keyTags = array($module, "{$module}_{$controller}", "{$module}_{$controller}_{$action}");
     if (false !== ($data = $this->getCache())) {
         $response = $this->getResponse();
         $response->setBody($data['default']);
         $response->sendResponse();
         exit;
     }
 }