redis-memo 0.1.3 → 0.1.4
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/cache.rb +10 -0
- data/lib/redis_memo/memoize_query/cached_select.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a03c34771a13ad121b14359ba0e7b3596ef37da5cbf1f6c46e59bf28238e5e5d
|
4
|
+
data.tar.gz: 55d84f1b82f40c261b0ff8a7a5faa868b50caf248e89e755b31a0011f1caab3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83638771de1cb0041c4864b71d53bb89c99508f2827db23b504f1751e1ad22cff7010451d5f47cdcb14ffb619162f16fe4cf177e403b0522e654b7e697b0b872
|
7
|
+
data.tar.gz: fc5df8d6c8a336985927a2f35b177373a8f2e4dcd2b87bccac705440eaeaabe1a09f3d90138543c528b4763b70edc38931e6c9bc642e362b2c5ffef61e088d16
|
data/lib/redis_memo/cache.rb
CHANGED
@@ -57,6 +57,16 @@ class RedisMemo::Cache < ActiveSupport::Cache::RedisCacheStore
|
|
57
57
|
Thread.current[THREAD_KEY_LOCAL_DEPENDENCY_CACHE]
|
58
58
|
end
|
59
59
|
|
60
|
+
# See https://github.com/rails/rails/blob/fe76a95b0d252a2d7c25e69498b720c96b243ea2/activesupport/lib/active_support/cache/redis_cache_store.rb#L477
|
61
|
+
# We overwrite this private method so we can also rescue ConnectionPool::TimeoutErrors
|
62
|
+
def failsafe(method, returning: nil)
|
63
|
+
yield
|
64
|
+
rescue ::Redis::BaseError, ::ConnectionPool::TimeoutError => e
|
65
|
+
handle_exception exception: e, method: method, returning: returning
|
66
|
+
returning
|
67
|
+
end
|
68
|
+
private :failsafe
|
69
|
+
|
60
70
|
class << self
|
61
71
|
def with_local_cache(&blk)
|
62
72
|
Thread.current[THREAD_KEY_LOCAL_CACHE] = {}
|
@@ -336,6 +336,11 @@ class RedisMemo::MemoizeQuery::CachedSelect
|
|
336
336
|
end
|
337
337
|
|
338
338
|
bind_params
|
339
|
+
|
340
|
+
when Arel::Nodes::NotEqual
|
341
|
+
# We don't cache based on NOT queries (where.not) because it is unbound
|
342
|
+
# but we memoize queries with NOT and other bound queries, so we return the original bind_params
|
343
|
+
return bind_params
|
339
344
|
else
|
340
345
|
# Not yet supported
|
341
346
|
return
|