doc/administration/invalidate_markdown_cache.md
{{< details >}}
{{< /details >}}
For performance reasons, GitLab caches the HTML version of Markdown text in fields such as:
These cached versions can become outdated, such as when the external_url configuration option is changed. Links
in the cached text would still refer to the old URL.
You can invalidate the Markdown cache by using either the API or the Rails console.
Prerequisites:
To invalidate the existing cache using the API:
Increase the local_markdown_version setting in application settings by sending a PUT request:
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/application/settings?local_markdown_version=<increased_number>"
For more information about this API endpoint, see update application settings.
Prerequisites:
To invalidate the cache for a group:
Start a Rails console:
sudo gitlab-rails console
Find the group to update:
group = Group.find(<group_id>)
Invalidate the cache for all projects in the group:
group.all_projects.each_slice(10) do |projects|
projects.each do |project|
# Invalidate issues
project.issues.update_all(
description_html: nil,
title_html: nil
)
# Invalidate merge requests
project.merge_requests.update_all(
description_html: nil,
title_html: nil
)
# Invalidate notes/comments
project.notes.update_all(note_html: nil)
end
# Pause for one second after updating 10 projects
sleep 1
end
To invalidate the cache for a single project:
Start a Rails console:
sudo gitlab-rails console
Find the project to update:
project = Project.find(<project_id>)
Invalidate issues:
project.issues.update_all(
description_html: nil,
title_html: nil
)
Invalidate merge requests:
project.merge_requests.update_all(
description_html: nil,
title_html: nil
)
Invalidate notes and comments:
project.notes.update_all(note_html: nil)