Service/DedicatedServer.php
public function getServerInfo($login)
    {
        static $lockAcquired = false;

        if (isset($this->servers[$login])) {
            $cacheKey = $this->_getServerInfoCacheKey($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->getServerInfo($login);

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

                return $data;
            } else {
                // We have the lock, data not in cache get data from the server.
                $data = $this->_getServerInfo($login);
                $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutInfo);

                return $data;
            }
        }

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

        if (isset($this->servers[$login])) {
            $cacheKey = $this->_getServerInfoCacheKey($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->getServerInfo($login);

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

                return $data;
            } else {
                // We have the lock, data not in cache get data from the server.
                $data = $this->_getServerInfo($login);
                $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutInfo);

                return $data;
            }
        }

        return null;
    }
public function getServerInfo ( $ login ) { static $ lockAcquired = false ; if ( isset ( $ this -> servers [ $ login ] ) ) { $ cacheKey = $ this -> _getServerInfoCacheKey ( $ 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 -> getServerInfo ( $ login ) ; // End protected code. $ lockAcquired = false ; $ this -> semaphore -> release ( $ cacheKey ) ; return $ data ; } else { // We have the lock, data not in cache get data from the server. $ data = $ this -> _getServerInfo ( $ login ) ; $ this -> serverInfoCache -> save ( $ cacheKey , $ data , $ this -> cacheTimeOutInfo ) ; return $ data ; } } return null ; }
Returns server information. If server information not in cache will make call to the dedicated server.
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 server information . If server information not in cache will make call to the dedicated server . Try to use this with ajax calls in order to have a faster website .