Example #1
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();
 }
Example #2
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");
 }