public function saveToCache()
    {
        if ($this->hasFrozenCacheInProduction()) {
            return;
        }
        if (!$this->initialized) {
            $this->initialize();
        }
        if ($this->loadFromClassSchemaRuntimeCache === true) {
            return;
        }

        if (!($this->reflectionDataCompiletimeCache instanceof FrontendInterface)) {
            throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
        }

        if (!empty($this->availableClassNames)) {
            $this->reflectionDataRuntimeCache->set('__availableClassNames', $this->availableClassNames);
        }

        if ($this->updatedReflectionData !== []) {
            $this->updateReflectionData();
        }

        if ($this->context->isProduction()) {
            $this->saveProductionData();
            return;
        }

        $this->saveDevelopmentData();
    }