public function update()
    {
        // First, let's see if our data is cached.
        $item = $this->cache->getItem("io.bitrank.$this->cacheHandle.init-data");

        $init_data = $item->get();

        if ($item->isMiss()) {
            if ($this->getTestParam('cache-must-hit')) {
                // This needs to be revisited. For now, this is only be thrown in tests.
                /** @noinspection PhpUnhandledExceptionInspection */
                throw new \Exception("Cache did not hit");
            }
    
            $item->lock();

            if ($this->requestStartTime == 0) {
                $this->requestStartTime = microtime(true);
            }

            try {
                $init_data = $this->retrieveInitData();
            } catch (Exception\RateLimitExceededException $rlx) {
                unset($item); // Clear lock
                if ((microtime(true) - $this->requestStartTime) < $this->timeout) {
                    usleep(100);
                    $this->update();
                    return;
                } else {
                    throw new TimeoutExceededException('The server was rate limiting the client, and retries could not be completed within the configured time limit');
                }
            }

            $item->set($init_data);
            // Cache is saved until x-data-version changes for the init-data request; do not timeout.
            // if ($this->cacheTimeout > 0) {
            //     $item->expiresAfter($this->cacheTimeout);
            // }

            $this->cache->save($item);
        } else {
            if ($this->getTestParam('cache-must-miss')) {
                // This needs to be revisited. For now, this is only be thrown in tests.
                /** @noinspection PhpUnhandledExceptionInspection */
                throw new \Exception("Cache did hit");
            }
            $this->dataVersion = $init_data['dataVersion'];
        }

        $this->localeData       = $init_data['locale'];
        $this->flags            = Flag::parseAPI($this, $init_data['flags']);
        $this->scores           = ScoreTiers::parseAPI($this, $init_data['scores']);
        $this->requestStartTime = 0;
    }