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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-25 18:10:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-25 18:10:33 +0300
commita8c1bc6f757ecacbc3481e52a3f4cefb6c6db5fd (patch)
tree7ba85d57835274f11674c33155e68b6af33f2687 /lib/gitlab/set_cache.rb
parent76ef00aac974a463243dcda6f692b17ff5d439bc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/set_cache.rb')
-rw-r--r--lib/gitlab/set_cache.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/set_cache.rb b/lib/gitlab/set_cache.rb
index 0f2b7b194c9..30cd63e80c0 100644
--- a/lib/gitlab/set_cache.rb
+++ b/lib/gitlab/set_cache.rb
@@ -14,15 +14,21 @@ module Gitlab
"#{key}:set"
end
+ # NOTE Remove as part of https://gitlab.com/gitlab-org/gitlab/-/issues/331319
+ def new_cache_key(key)
+ "#{cache_namespace}:#{key}:set"
+ end
+
# Returns the number of keys deleted by Redis
def expire(*keys)
return 0 if keys.empty?
with do |redis|
- keys = keys.map { |key| cache_key(key) }
+ keys_to_expire = keys.map { |key| cache_key(key) }
+ keys_to_expire += keys.map { |key| new_cache_key(key) } # NOTE Remove as part of #331319
Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do
- redis.unlink(*keys)
+ redis.unlink(*keys_to_expire)
end
end
end
@@ -73,5 +79,9 @@ module Gitlab
def with(&blk)
Gitlab::Redis::Cache.with(&blk) # rubocop:disable CodeReuse/ActiveRecord
end
+
+ def cache_namespace
+ Gitlab::Redis::Cache::CACHE_NAMESPACE
+ end
end
end