Use database cache rather than Redis cache in Banzai::ReferenceExtractor

Description

In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6095 we moved caching rendered Markdown from Redis to the database. However, we still use Redis in Banzai::ReferenceExtractor (see https://gitlab.com/gitlab-org/gitlab-ce/issues/23343#note_18523911). We should use values cached in the database instead.

Proposal

Change Banzai::ReferenceExtractor to use cached values from the database if they are available for the passed parameters. Currently Banzai::ReferenceExtractor is described as:

Extract possible GFM references from an arbitrary String for further processing.

We should investigate if it really needs to work with arbitrary strings. Possibly it can be changed to support only specific models that have database cache if we always use it in that context.

Yes, it needs to work with arbitrary strings, because we use it to preview Markdown (for example in comments) and at this stage we don't have anything in the database.

/cc @yorickpeterse @nick.thomas

Edited Aug 14, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading