diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-11-20 14:03:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-11-20 14:03:17 +0300 |
commit | e65e184269bb27661c9a20658933e8482aa90b62 (patch) | |
tree | 6eb7ac02e015324bc6f9450e8567cbe86976cc8e /lib | |
parent | 646ba2418b630710edeaac94b57d08adf2771257 (diff) | |
parent | 7d629787fb4a676798e8545b13e48c540d473986 (diff) |
Merge branch '3062-improve-project-cache' into 'master'
Change project cache key to depend on ID instead of full path
Closes #42191
See merge request gitlab-org/gitlab-ce!23135
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/cache/ci/project_pipeline_status.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/repository_cache.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/cache/ci/project_pipeline_status.rb b/lib/gitlab/cache/ci/project_pipeline_status.rb index dfbb83f7bb9..78b0eaac8cd 100644 --- a/lib/gitlab/cache/ci/project_pipeline_status.rb +++ b/lib/gitlab/cache/ci/project_pipeline_status.rb @@ -42,7 +42,7 @@ module Gitlab end def self.cache_key_for_project(project) - "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:projects/#{project.id}/pipeline_status/#{project.commit&.sha}" + "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status:#{project.commit&.sha}" end def self.update_for_pipeline(pipeline) diff --git a/lib/gitlab/repository_cache.rb b/lib/gitlab/repository_cache.rb index 56007574b1b..6b0808f5304 100644 --- a/lib/gitlab/repository_cache.rb +++ b/lib/gitlab/repository_cache.rb @@ -7,13 +7,13 @@ module Gitlab def initialize(repository, extra_namespace: nil, backend: Rails.cache) @repository = repository - @namespace = "#{repository.full_path}:#{repository.project.id}" + @namespace = "project:#{repository.project.id}" @namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace @backend = backend end def cache_key(type) - "#{type}:#{namespace}" + "#{namespace}:#{type}" end def expire(key) |