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-06-16 21:25:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /lib/gitlab/set_cache.rb
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
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