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 'doc/development/redis.md')
-rw-r--r--doc/development/redis.md22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/development/redis.md b/doc/development/redis.md
index 68cab9ac38d..a2dbf52822e 100644
--- a/doc/development/redis.md
+++ b/doc/development/redis.md
@@ -4,7 +4,7 @@ group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
-# Redis guidelines
+# Redis development guidelines
## Redis instances
@@ -188,6 +188,26 @@ it 'avoids N+1 Redis calls to forks_count key' do
end
```
+You also can use special matchers `exceed_redis_calls_limit` and
+`exceed_redis_command_calls_limit` to define an upper limit for
+a number of Redis calls:
+
+```ruby
+it 'avoids N+1 Redis calls' do
+ control = RedisCommands::Recorder.new { visit_page }
+
+ expect(control).not_to exceed_redis_calls_limit(1)
+end
+```
+
+```ruby
+it 'avoids N+1 sadd Redis calls' do
+ control = RedisCommands::Recorder.new { visit_page }
+
+ expect(control).not_to exceed_redis_command_calls_limit(:sadd, 1)
+end
+```
+
These tests can help to identify N+1 problems related to Redis calls,
and make sure that the fix for them works as expected.