Fix in-memory representation of ApplicationSetting

Problem

After updating the settings in a SSoT service, the cache should be invalidated consistently. We use in-memory application settings especially in specs and this doesn't behave consistently because the cache is ignored and the modified version of the settings is not retained in memory.

See https://gitlab.com/gitlab-org/gitlab/-/blob/239df5515d5c833e2f7b7676ef4949b53667e8e6/app/services/app_config/update_settings_service.rb#L19-22.

When using in-memory settings, any updates persisted in the database should be reflected in the in-memory representation. The in-memory should be a default source when the ApplicationSetting record doesn't exist in the database, to ensure we always have some settings.

Edited by Fabio Pitino - PTO until Jan 1