Skip to content

Change project cache key to depend on ID instead of full path

Gabriel Mazetto requested to merge 3062-improve-project-cache into master

What does this MR do?

Change project cache key to depend on ID instead of full path

Previously, project cache used as part of the namespace the full_path, which included the namespace and project slug.

That meant that anytime a project was renamed or transferred to a different namespace, we would lose the existing cache.

This is not necessary, nor desired.

I've prefixed cache key with project: to make it easy to find in redis if necessary as well as make it possible to do any project related operations just by looking at the pattern: project:#{id}:#{type}


Similar change was done to the project pipeline status cache key to follow the new convention.

Old cache key was: projects/#{id}/pipeline_status/#{sha} New one is: project:#{id}:pipeline_status:#{sha}

What are the relevant issue numbers?

See the previous discussion here: https://gitlab.com/gitlab-org/gitlab-ee/issues/3062#note_36468758

Does this MR meet the acceptance criteria?

Related to gitlab-org/gitlab-ee#3062 Closes #42191 (closed)

Edited by Gabriel Mazetto

Merge request reports