diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-07-25 16:16:19 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-27 14:11:38 +0300 |
commit | 1fed50822051bd49e7a3438645d5db2d9d53b9be (patch) | |
tree | 95ffe7e4ef7289d72551d320eac0557a352d8b88 /lib | |
parent | 54b71febb29908f9d9077847036aebb64a727e82 (diff) |
Merge branch 'use-project-id-in-repo-cache' into 'master'
Use project ID in repository cache to prevent stale data from persisting across projects
See merge request !5460
Signed-off-by: Rémy Coutable <remy@rymai.me>
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) |