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

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

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

                return $data;
            } else {
                $data = array();
                try {
                    $connection = $this->getConnection($login);
                    if ($connection) {
                        $data = $connection->getMapList(-1, 0);
                        $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutMap);
                    }
                } catch (\Exception $e) {
                    //If can't connect keep shorter in cache
                    $this->serverInfoCache->save($cacheKey, array(), $this->cacheTimeOutMapRetry);
                }

                return $data;
            }
        }
    }
public function getMapList($login) {
        static $lockAcquired = false;

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

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

                return $data;
            } else {
                $data = array();
                try {
                    $connection = $this->getConnection($login);
                    if ($connection) {
                        $data = $connection->getMapList(-1, 0);
                        $this->serverInfoCache->save($cacheKey, $data, $this->cacheTimeOutMap);
                    }
                } catch (\Exception $e) {
                    //If can't connect keep shorter in cache
                    $this->serverInfoCache->save($cacheKey, array(), $this->cacheTimeOutMapRetry);
                }

                return $data;
            }
        }
    }
public function getMapList ( $ login ) { static $ lockAcquired = false ; if ( isset ( $ this -> servers [ $ login ] ) ) { $ cacheKey = $ this -> _getServerMapsCacheKey ( $ 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 -> getMapList ( $ login ) ; // End protected code. $ lockAcquired = false ; $ this -> semaphore -> release ( $ cacheKey ) ; return $ data ; } else { $ data = array ( ) ; try { $ connection = $ this -> getConnection ( $ login ) ; if ( $ connection ) { $ data = $ connection -> getMapList ( - 1 , 0 ) ; $ this -> serverInfoCache -> save ( $ cacheKey , $ data , $ this -> cacheTimeOutMap ) ; } } catch ( \ Exception $ e ) { //If can't connect keep shorter in cache $ this -> serverInfoCache -> save ( $ cacheKey , array ( ) , $ this -> cacheTimeOutMapRetry ) ; } return $ data ; } } }
Returns list of maps on the server. If list of map not in cache will make a call to the dedicatd server.
Try to use this with ajax calls in order to have a faster website.

@param string $login Login of the server

@return \Maniaplanet\DedicatedServer\Structures\Map[]
Returns list of maps on the server . If list of map not in cache will make a call to the dedicatd server . Try to use this with ajax calls in order to have a faster website .