Exemplo n.º 1
0
 public function compress(BaseEvent $event)
 {
     $this->outputHandler->header('Content-Encoding: gzip');
     if ($this->compressionType == self::COMPRESSION_GZIP) {
         $event->getPoc()->setOutput(\gzencode($event->getPoc()->getOutput(), 9, FORCE_GZIP));
     } elseif ($this->compressionType == self::COMPRESSION_DEFLATE) {
         $event->getPoc()->setOutput(\gzdeflate($event->getPoc()->getOutput()));
     }
 }
Exemplo n.º 2
0
 public function pocCallbackCache($buffer)
 {
     $this->poc->setOutput($buffer);
     $this->poc->getPocDispatcher()->dispatch(CallbackHandlerEventNames::BEFORE_OUTPUT_SENT_TO_CLIENT_FETCHED_FROM_CACHE, new BaseEvent($this->poc));
     $this->outputHandler->ObPrintCallback($this->poc->getOutput());
     return $this->poc->getOutput();
 }
Exemplo n.º 3
0
 public function endOfBuffering(BaseEvent $event)
 {
     if (isset($this->level)) {
         if ($this->level) {
             $this->outputHandler->obEnd();
         }
     }
 }
Exemplo n.º 4
0
 public function consult(BaseEvent $event)
 {
     $sentinelCnt = $this->getSentinel();
     $this->setSentinel($sentinelCnt + 1);
     if ($sentinelCnt) {
         $this->eventDispatcher->dispatch(ROIProtectorEventNames::CONSULT_STARTED, new ROIEvent($this));
         if ($sentinelCnt >= 1 and $sentinelCnt <= 2) {
             while ($this->getSentinel()) {
                 //                        $this->monoLogger->setLog(self::LOG_TYPE_CIA,
                 //                                "Sleep: $sentinelCnt");
                 usleep(500000);
             }
             echo $this->poc->fetchCache();
         }
         if ($sentinelCnt >= $this->maxNumberOfConcurrentConnections) {
             $this->outputHandler->ObPrintCallback($this->getRefreshPage());
             $this->outputHandler->stopBuffer();
         }
     }
     //        $this->monoLogger->setLog(self::LOG_TYPE_CIA, "end: $sentinelCnt");
 }