diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/gitlab/cache | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/gitlab/cache')
-rw-r--r-- | lib/gitlab/cache/import/caching.rb | 11 |
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 |