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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d4fa9d940a295287a258f88f3cbc44498a6e5475a58c0cdb8e5e320d2793652
4
- data.tar.gz: bbe225fc22a568c3de716feba66b3a1fbbdeb52a1ef4c2c4a47b94bbfa8a33cb
3
+ metadata.gz: a03c34771a13ad121b14359ba0e7b3596ef37da5cbf1f6c46e59bf28238e5e5d
4
+ data.tar.gz: 55d84f1b82f40c261b0ff8a7a5faa868b50caf248e89e755b31a0011f1caab3f
5
5
  SHA512:
6
- metadata.gz: 3d5ec94adc1f74479690f5dc95eb7459b777de63827baa59302931287222266d33def750d9649c8c8e37a4fd43d95c7fac7c79b8ec012848f51ae5fad5f5ec91
7
- data.tar.gz: 2219225dea50042b8f99dadcdad44f367d48c74573d3ac29ef0e4060c0dc7fee13a58034420229386bd16b408f6797718714e15af2710a954ad89964e7c21d5d
6
+ metadata.gz: 83638771de1cb0041c4864b71d53bb89c99508f2827db23b504f1751e1ad22cff7010451d5f47cdcb14ffb619162f16fe4cf177e403b0522e654b7e697b0b872
7
+ data.tar.gz: fc5df8d6c8a336985927a2f35b177373a8f2e4dcd2b87bccac705440eaeaabe1a09f3d90138543c528b4763b70edc38931e6c9bc642e362b2c5ffef61e088d16
@@ -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
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chan Zuckerberg Initiative