switchman 1.14.4 → 1.14.5

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: 8afca28f08e2790f1ea2ff7cb19b1920a30da7eea8fca6d1e766f0550178e451
4
- data.tar.gz: e10d84284ce03587f66dffa474fdd78f07fbd3a4b35139640713a0f8283a1c26
3
+ metadata.gz: f75c819fb04253c0a686dbfeead8f7df63315d09a24143ede35f1bb65821296a
4
+ data.tar.gz: ee1ef75ff91973e810938b81e1ade42a2f9b48a3f5f8897bbefa35b85146cb12
5
5
  SHA512:
6
- metadata.gz: ae60e16501fb7c1b0641fb546f78013b61c96cbb01c9b1f485ef6d23c5ed1aceedd86aad508e3a3e986dd59f07eb4a414e4b3d61a1959bc8ec58de1ace58e07b
7
- data.tar.gz: d52f3b4b4a77d517067d988b48a4254d6f734d4f59ec7e7a973affd63fcfe7e8de8c0f4ecd69baa083c90d665e323e3327431f7ef3379e648ef81fdef8c3f89b
6
+ metadata.gz: 2acf90222fa2091a9311dda52ac523099ee1eaf6325058d39a7973c75654991cc925bdcc5e6983814ab6c4c33c0967b1ea0c8688da97243edc34dddf253ea92d
7
+ data.tar.gz: c203ee0e6b8e1d5bdb66723ece7c2abf5cf532c3c1cf2f1e7fb97dc3509a9ae4d164c147da81604d15ef4750a125449c7d693e264c207a9d017a75bb3c27021a
@@ -4,10 +4,26 @@ module Switchman
4
4
  module ClassMethods
5
5
  def lookup_store(*store_options)
6
6
  store = super
7
+ # can't use defined?, because it's a _ruby_ autoloaded constant,
8
+ # so just checking that will cause it to get required
9
+ if store.class.name == "ActiveSupport::Cache::RedisCacheStore" && !::ActiveSupport::Cache::RedisCacheStore.ancestors.include?(RedisCacheStore)
10
+ ::ActiveSupport::Cache::RedisCacheStore.prepend(RedisCacheStore)
11
+ end
7
12
  store.options[:namespace] ||= lambda { Shard.current.default? ? nil : "shard_#{Shard.current.id}" }
8
13
  store
9
14
  end
10
15
  end
16
+
17
+ module RedisCacheStore
18
+ def clear(options = {})
19
+ # RedisCacheStore tries to be smart and only clear the cache under your namespace, if you have one set
20
+ # unfortunately, it uses the keys command, which is extraordinarily inefficient in a large redis instance
21
+ # fortunately, we can assume we control the entire instance, because we set up the namespacing, so just
22
+ # always unset it temporarily for clear calls
23
+ options[:namespace] = nil
24
+ super
25
+ end
26
+ end
11
27
  end
12
28
  end
13
29
  end
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.14.4"
2
+ VERSION = "1.14.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.4
4
+ version: 1.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-08-05 00:00:00.000000000 Z
13
+ date: 2019-08-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties