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:
Diffstat (limited to 'lib/gitlab/cache/import/caching.rb')
-rw-r--r--lib/gitlab/cache/import/caching.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/cache/import/caching.rb b/lib/gitlab/cache/import/caching.rb
index 7f2d2858149..ec94991157a 100644
--- a/lib/gitlab/cache/import/caching.rb
+++ b/lib/gitlab/cache/import/caching.rb
@@ -113,15 +113,18 @@ module Gitlab
end
end
- # Sets multiple keys to a given value.
+ # Sets multiple keys to given values.
#
# mapping - A Hash mapping the cache keys to their values.
+ # key_prefix - prefix inserted before each key
# timeout - The time after which the cache key should expire.
- def self.write_multiple(mapping, timeout: TIMEOUT)
+ def self.write_multiple(mapping, key_prefix: nil, timeout: TIMEOUT)
Redis::Cache.with do |redis|
- redis.multi do |multi|
+ redis.pipelined do |multi|
mapping.each do |raw_key, value|
- multi.set(cache_key_for(raw_key), value, ex: timeout)
+ key = cache_key_for("#{key_prefix}#{raw_key}")
+
+ multi.set(key, value, ex: timeout)
end
end
end