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 +4 -4
- data/lib/switchman/active_support/cache.rb +16 -0
- data/lib/switchman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f75c819fb04253c0a686dbfeead8f7df63315d09a24143ede35f1bb65821296a
|
4
|
+
data.tar.gz: ee1ef75ff91973e810938b81e1ade42a2f9b48a3f5f8897bbefa35b85146cb12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/switchman/version.rb
CHANGED
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
|
+
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-
|
13
|
+
date: 2019-08-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|