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/markdown_cache/redis/store.rb')
-rw-r--r--lib/gitlab/markdown_cache/redis/store.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/gitlab/markdown_cache/redis/store.rb b/lib/gitlab/markdown_cache/redis/store.rb
index 0f954404808..5a8efa34097 100644
--- a/lib/gitlab/markdown_cache/redis/store.rb
+++ b/lib/gitlab/markdown_cache/redis/store.rb
@@ -6,6 +6,20 @@ module Gitlab
class Store
EXPIRES_IN = 1.day
+ def self.bulk_read(subjects)
+ results = {}
+
+ Gitlab::Redis::Cache.with do |r|
+ r.pipelined do
+ subjects.each do |subject|
+ results[subject.cache_key] = new(subject).read
+ end
+ end
+ end
+
+ results
+ end
+
def initialize(subject)
@subject = subject
@loaded = false
@@ -23,13 +37,9 @@ module Gitlab
def read
@loaded = true
- results = Gitlab::Redis::Cache.with do |r|
+ Gitlab::Redis::Cache.with do |r|
r.mapped_hmget(markdown_cache_key, *fields)
end
- # The value read from redis is a string, so we're converting it back
- # to an int.
- results[:cached_markdown_version] = results[:cached_markdown_version].to_i
- results
end
def loaded?