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:
authorRémy Coutable <remy@rymai.me>2018-05-29 19:39:03 +0300
committerRémy Coutable <remy@rymai.me>2018-06-01 15:01:27 +0300
commit4eda09e3fbfe82fd1467e97cbc5bd085b91f257d (patch)
treedb0e8fbd141ff3252df450f60b9f1f5636c68489 /spec/models/concerns
parenta886532cc04bfa7ec6885ea883889f6d138961bd (diff)
Use RequestStore in CacheableAttributes.cached for greater performance
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/cacheable_attributes_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/concerns/cacheable_attributes_spec.rb b/spec/models/concerns/cacheable_attributes_spec.rb
index 77f46518d47..c6331c5ec15 100644
--- a/spec/models/concerns/cacheable_attributes_spec.rb
+++ b/spec/models/concerns/cacheable_attributes_spec.rb
@@ -177,6 +177,15 @@ describe CacheableAttributes do
end
end
end
+
+ it 'uses RequestStore in addition to Rails.cache', :request_store do
+ # Warm up the cache
+ create(:application_setting).cache!
+
+ expect(Rails.cache).to receive(:read).with(ApplicationSetting.cache_key).once.and_call_original
+
+ 2.times { ApplicationSetting.current }
+ end
end
describe '.cached', :use_clean_rails_memory_store_caching do