2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-04 08:47:37 +08:00

DEV: s/\$redis/Discourse\.redis (#8431)

This commit also adds a rubocop rule to prevent global variables.
This commit is contained in:
Joffrey JAFFEUX 2019-12-03 10:05:53 +01:00 committed by GitHub
parent 9eccfb7b52
commit 0d3d2c43a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
118 changed files with 378 additions and 362 deletions

View file

@ -7,14 +7,14 @@ Benchmark.ips do |x|
x.report("redis setex string") do |times|
while times > 0
$redis.setex("test_key", 60, "test")
Discourse.redis.setex("test_key", 60, "test")
times -= 1
end
end
x.report("redis setex marshal string") do |times|
while times > 0
$redis.setex("test_keym", 60, Marshal.dump("test"))
Discourse.redis.setex("test_keym", 60, Marshal.dump("test"))
times -= 1
end
end
@ -39,14 +39,14 @@ end
Benchmark.ips do |x|
x.report("redis get string") do |times|
while times > 0
$redis.get("test_key")
Discourse.redis.get("test_key")
times -= 1
end
end
x.report("redis get string marshal") do |times|
while times > 0
Marshal.load($redis.get("test_keym"))
Marshal.load(Discourse.redis.get("test_keym"))
times -= 1
end
end