redis-memo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_memo/memoize_query/cached_select.rb +0 -3
- data/lib/redis_memo/testing.rb +55 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 976988ff54686693396ffb07c47b9e4326646837b3be53264891c886f03771c6
|
4
|
+
data.tar.gz: 9e4a3d4dca78cb9389af8e1728addb3aa8d04493365bcfda2ea236e20c657971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 118d801be413e14616becfb3a9c4e4715a1e7b7cb6722ac48bd8b1c63e6b1c8f565c8a148909b4bd7b4b538f89d1d79145ad137403139eb7158cad61c9d7a847
|
7
|
+
data.tar.gz: 52bdf762fc8bf22a6b65fc158512e001dd12490904db9766cd9f3ff1aee74e61f23f218bfa46cdf57fdb67f9f0d2508649fedc2379d6224d0d34416ffbafb902
|
@@ -267,9 +267,6 @@ class RedisMemo::MemoizeQuery::CachedSelect
|
|
267
267
|
|
268
268
|
bind_params
|
269
269
|
when Arel::Nodes::SelectStatement
|
270
|
-
# No OREDER BY
|
271
|
-
return unless node.orders.empty?
|
272
|
-
|
273
270
|
node.cores.each do |core|
|
274
271
|
# We don't support JOINs
|
275
272
|
return unless core.source.right.empty?
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Redis memo can be flaky due to transient network errors (e.g. Redis connection errors), or when
|
4
|
+
# used with async handlers. This class allows users to override the default redis-memo behavior
|
5
|
+
# to be more robust when testing their code that uses redis-memo.
|
6
|
+
module RedisMemo
|
7
|
+
class Testing
|
8
|
+
|
9
|
+
def self.__test_mode
|
10
|
+
@__test_mode
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.__test_mode=(mode)
|
14
|
+
@__test_mode = mode
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.enable_test_mode(&blk)
|
18
|
+
__set_test_mode(true, &blk)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.disable_test_mode(&blk)
|
22
|
+
__set_test_mode(false, &blk)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.enabled?
|
26
|
+
__test_mode
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def self.__set_test_mode(mode, &blk)
|
32
|
+
if blk.nil?
|
33
|
+
__test_mode = mode
|
34
|
+
else
|
35
|
+
prev_mode = __test_mode
|
36
|
+
begin
|
37
|
+
__test_mode = mode
|
38
|
+
yield
|
39
|
+
ensure
|
40
|
+
__test_mode = prev_mode
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module TestOverrides
|
47
|
+
def without_memo?
|
48
|
+
if RedisMemo::Testing.enabled? && !RedisMemo::Memoizable::Invalidation.class_variable_get(:@@invalidation_queue).empty?
|
49
|
+
return true
|
50
|
+
end
|
51
|
+
super
|
52
|
+
end
|
53
|
+
end
|
54
|
+
singleton_class.prepend(TestOverrides)
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-memo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chan Zuckerberg Initiative
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/redis_memo/middleware.rb
|
193
193
|
- lib/redis_memo/options.rb
|
194
194
|
- lib/redis_memo/redis.rb
|
195
|
+
- lib/redis_memo/testing.rb
|
195
196
|
- lib/redis_memo/tracer.rb
|
196
197
|
homepage: https://github.com/chanzuckerberg/redis-memo
|
197
198
|
licenses:
|