Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2018-11-16 06:56:27 +0300
committerGabriel Mazetto <brodock@gmail.com>2018-11-16 18:22:53 +0300
commit19440e67225d41ff821a9e31f47d60fe7a1718c2 (patch)
tree63df7da4b0fad6e8124d626229643de67ddc435d /lib/gitlab/repository_cache.rb
parent624ec62238c1d26ef2745c1147edffde67a2b4e6 (diff)
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 namespace and project slug. That meant that anytime a project was renamed or transfered 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 purge all project related cache. I've also switched the cache key type to go after the initial namespace and not before.
Diffstat (limited to 'lib/gitlab/repository_cache.rb')
-rw-r--r--lib/gitlab/repository_cache.rb4
1 files changed, 2 insertions, 2 deletions
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)