Pages Internal API Caching
## What For `GET /api/internal/pages?host=HOST`. This is the API endpoint that gets called by GitLab pages when a request comes in and we haven't cached in gitlab-pages what needs to be served for this. Given that the `satisfiedThreshold` for writing headers for a response is 0.5s, ideally, this would be even faster than the threshold set for `web-pages`. We think 0.5s for serving a static page is an acceptable target. ## Proposed solution Since this information generally does not change a lot, we could add a cache for the JSON response of this endpoint to help the metrics. Introduced in https://gitlab.com/gitlab-org/gitlab/-/issues/363867, the cache will: - Use the to level (root) namespace id as the key, or - For custom domains, use the project id as the key - The cache time must be configurable (https://gitlab.com/gitlab-org/gitlab/-/issues/363867#note_975021875) ### Events that invalidate the cache - [x] Pages deployed - https://gitlab.com/gitlab-org/gitlab/-/issues/363867 - [x] Pages deleted - https://gitlab.com/gitlab-org/gitlab/-/issues/364070 - [x] Project deleted - https://gitlab.com/gitlab-org/gitlab/-/issues/364065 - [x] Project created - https://gitlab.com/gitlab-org/gitlab/-/issues/364062 - [x] Project path change - https://gitlab.com/gitlab-org/gitlab/-/issues/364063 - [x] Project archived - https://gitlab.com/gitlab-org/gitlab/-/issues/364066 - [x] Project moved/transferred - https://gitlab.com/gitlab-org/gitlab/-/issues/364064 - [x] Group moved/transferred - https://gitlab.com/gitlab-org/gitlab/-/issues/364068 - [x] Group path change - https://gitlab.com/gitlab-org/gitlab/-/issues/364067 - [x] Group deleted - https://gitlab.com/gitlab-org/gitlab/-/issues/364069 - [x] Pages domain updated - https://gitlab.com/gitlab-org/gitlab/-/issues/374541 - [x] Pages domain deleted - https://gitlab.com/gitlab-org/gitlab/-/issues/374542 - [x] Application settings updated - https://gitlab.com/gitlab-org/gitlab/-/issues/374545 - [x] Pages domain created - https://gitlab.com/gitlab-org/gitlab/-/issues/374027 - ~Project settings updated - https://gitlab.com/gitlab-org/gitlab/-/issues/374543~ this was breakdown in the next issues: - [x] Project attributes updated - https://gitlab.com/gitlab-org/gitlab/-/issues/376297 - [x] Project features updated - https://gitlab.com/gitlab-org/gitlab/-/issues/376298
epic