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>2020-06-15 21:08:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-15 21:08:43 +0300
commit3caf5a8a007d8d9e9a86b7c847b5d9cfa6d41843 (patch)
tree6831279652bf5379c4650e2fd44c69663e1260c8 /lib/gitlab/cache
parent4774fa00b74a9248b2d14fc424a8c2f1abb0a0de (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/cache')
-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