public function getCachedValue($name, $checkWithActiveProfiles = true)
    {
        if ($this->cache->contains($name)) {
            $setting = $this->cache->fetch($name);
        } elseif ($this->has($name)) {
            $settingDocument = $this->get($name);
            $setting = [
                'value' => $settingDocument->getValue(),
                'profiles' => $settingDocument->getProfile(),
            ];
            $this->cache->save($name, $setting);
        } else {
            return null;
        }

        if ($checkWithActiveProfiles) {
            if (count(array_intersect($this->getActiveProfiles(), $setting['profiles']))) {
                return $setting['value'];
            }

            return null;
        }

        return $setting['value'];
    }