diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-24 10:39:28 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-25 05:09:28 -0700 |
commit | 3618796e15d542293aaa721045ff943d360d963a (patch) | |
tree | a9f0f4eaf7c3671b1158f975973765cc38d60563 /lib | |
parent | 83180110348af1b244d56e9cdf5f29c5d6f84db0 (diff) | |
download | gitlab-ce-3618796e15d542293aaa721045ff943d360d963a.tar.gz |
Use project ID in repository cache to prevent stale data from persisting across projects
We have a number of bugs caused by cache keys not being flushed
properly during deletion of a project. Add the project ID to ensure
this never happens.
Closes #20027
Diffstat (limited to 'lib')
-rw-r--r-- | lib/repository_cache.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/repository_cache.rb b/lib/repository_cache.rb index 8ddc3511293..068a95790c0 100644 --- a/lib/repository_cache.rb +++ b/lib/repository_cache.rb @@ -1,14 +1,15 @@ # Interface to the Redis-backed cache store used by the Repository model class RepositoryCache - attr_reader :namespace, :backend + attr_reader :namespace, :backend, :project_id - def initialize(namespace, backend = Rails.cache) + def initialize(namespace, project_id, backend = Rails.cache) @namespace = namespace @backend = backend + @project_id = project_id end def cache_key(type) - "#{type}:#{namespace}" + "#{type}:#{namespace}:#{project_id}" end def expire(key) |