public function getServerChatLines($login)
    {
        static $lockAcquired = false;

        if (isset($this->servers[$login])) {
            $cacheKey = $this->_getServerChatCacheKey($login);
            $cacheResult = $this->serverInfoCache->fetch($cacheKey);
            if ($cacheResult) {
                return $cacheResult;
            } else if (!$lockAcquired) {
                // We don't have the lock, we need to get it before asking the dedicated.

                // Start Protected code.
                $this->semaphore->aquire($cacheKey);
                $lockAcquired = true;

                // Ask for data again, if cache filled from other instance then data from cache, if not wil do a call.
                $data = $this->getServerChatLines($login);

                // End protected code.
                $lockAcquired = false;
                $this->semaphore->release($cacheKey);

                return $data;
            } else {
                $data = array();
                try {
                    $connection = $this->getConnection($login);
                    if ($connection) {
                        $data = $connection->getChatLines();
                    }
                } catch (\Exception $e) {

                }
                $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutChat);

                return $data;
            }
        }

        return null;
    }
public function getServerChatLines($login)
    {
        static $lockAcquired = false;

        if (isset($this->servers[$login])) {
            $cacheKey = $this->_getServerChatCacheKey($login);
            $cacheResult = $this->serverInfoCache->fetch($cacheKey);
            if ($cacheResult) {
                return $cacheResult;
            } else if (!$lockAcquired) {
                // We don't have the lock, we need to get it before asking the dedicated.

                // Start Protected code.
                $this->semaphore->aquire($cacheKey);
                $lockAcquired = true;

                // Ask for data again, if cache filled from other instance then data from cache, if not wil do a call.
                $data = $this->getServerChatLines($login);

                // End protected code.
                $lockAcquired = false;
                $this->semaphore->release($cacheKey);

                return $data;
            } else {
                $data = array();
                try {
                    $connection = $this->getConnection($login);
                    if ($connection) {
                        $data = $connection->getChatLines();
                    }
                } catch (\Exception $e) {

                }
                $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutChat);

                return $data;
            }
        }

        return null;
    }
public function getServerChatLines ( $ login ) { static $ lockAcquired = false ; if ( isset ( $ this -> servers [ $ login ] ) ) { $ cacheKey = $ this -> _getServerChatCacheKey ( $ login ) ; $ cacheResult = $ this -> serverInfoCache -> fetch ( $ cacheKey ) ; if ( $ cacheResult ) { return $ cacheResult ; } else if ( ! $ lockAcquired ) { // We don't have the lock, we need to get it before asking the dedicated. // Start Protected code. $ this -> semaphore -> aquire ( $ cacheKey ) ; $ lockAcquired = true ; // Ask for data again, if cache filled from other instance then data from cache, if not wil do a call. $ data = $ this -> getServerChatLines ( $ login ) ; // End protected code. $ lockAcquired = false ; $ this -> semaphore -> release ( $ cacheKey ) ; return $ data ; } else { $ data = array ( ) ; try { $ connection = $ this -> getConnection ( $ login ) ; if ( $ connection ) { $ data = $ connection -> getChatLines ( ) ; } } catch ( \ Exception $ e ) { } $ this -> serverInfoCache -> save ( $ cacheKey , $ data , $ this -> cacheTimeOutChat ) ; return $ data ; } } return null ; }
Returns chat lines.
Try to use this with ajax calls in order to have a faster website.

@param string $login Login of the server

@return ServerInfo|null
Returns chat lines . Try to use this with ajax calls in order to have a faster website .