switchman 1.2.26 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d446c88ba224e3f62f97e7be128f115b39fa5a47
4
- data.tar.gz: c9666aec9c95601747ad1ea10378b6fa53741df9
3
+ metadata.gz: cc02882f4279799a148bcc079edfc5d54949c663
4
+ data.tar.gz: ed888b8fba4248f9a8b91c3b85a76083989e5e2f
5
5
  SHA512:
6
- metadata.gz: 78d66269b0fb652e685c324b6ea38a92b18f31fddab28109ef7144581e37c989c2e6c0a84b3ad461f3aafe7624f0333267b5c176093b4d7e12d8e0f356fcf416
7
- data.tar.gz: a90ec46fa09167fe4456d25facd7b3c65020751ec90ede6ec634a43edb737425ba959363423dd1d9f6c704ecebec06029beba616c0682297dc021097937217cc
6
+ metadata.gz: ea9c6c5123e48a0c2e0f3bb8016cbb3329caa575f05e0a8c46d2ab9ffc2469e1bf93ec02a743863e59052aa53f4941216ba7131dc4803831c0fe14a6d44043fb
7
+ data.tar.gz: 8ad1c1fb65aab94fc49095db4c537b29d9c04e23f9689136b492e24de89c09c376f88fcef322e1d91752616eaa23a308985f56adb79ad83cdc3feed376fea103
@@ -77,7 +77,7 @@ module Switchman
77
77
  cached_shards[id] ||= Shard.default.activate do
78
78
  # can't simply cache the AR object since Shard has a custom serializer
79
79
  # that calls this method
80
- attributes = ::Rails.cache.fetch(['shard', id].join('/')) do
80
+ attributes = Switchman.cache.fetch(['shard', id].join('/')) do
81
81
  shard = find_by_id(id)
82
82
  if shard
83
83
  attributes = shard.attributes
@@ -543,7 +543,7 @@ module Switchman
543
543
 
544
544
  def clear_cache
545
545
  Shard.default.activate do
546
- ::Rails.cache.delete(['shard', id].join('/'))
546
+ Switchman.cache.delete(['shard', id].join('/'))
547
547
  end
548
548
  end
549
549
 
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.2.26"
2
+ VERSION = "1.2.27"
3
3
  end
data/lib/switchman.rb CHANGED
@@ -7,4 +7,12 @@ module Switchman
7
7
  # TODO: load from yaml
8
8
  @config ||= {}
9
9
  end
10
+
11
+ def self.cache
12
+ (@cache.respond_to?(:call) ? @cache.call : @cache) || ::Rails.cache
13
+ end
14
+
15
+ def self.cache=(cache)
16
+ @cache = cache
17
+ end
10
18
  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.2.26
4
+ version: 1.2.27
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: 2015-01-28 00:00:00.000000000 Z
13
+ date: 2015-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties