seamusabshere-cache-money 0.2.6 → 0.2.7

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.
Files changed (3) hide show
  1. data/lib/cache_money.rb +1 -1
  2. data/lib/cash/local.rb +11 -1
  3. metadata +1 -1
data/lib/cache_money.rb CHANGED
@@ -28,7 +28,7 @@ class ActiveRecord::Base
28
28
  def self.is_cached(options = {})
29
29
  options.assert_valid_keys(:ttl, :repository, :version)
30
30
  include Cash
31
- Config.create(self, options)
31
+ Cash::Config::Config.create(self, options)
32
32
  end
33
33
  end
34
34
 
data/lib/cash/local.rb CHANGED
@@ -14,7 +14,17 @@ module Cash
14
14
  end
15
15
 
16
16
  def method_missing(method, *args, &block)
17
- @remote_cache.send(method, *args, &block)
17
+ autoload_missing_constants do
18
+ @remote_cache.send(method, *args, &block)
19
+ end
20
+ end
21
+
22
+ def autoload_missing_constants
23
+ yield
24
+ rescue ArgumentError, MemCache::MemCacheError => error
25
+ lazy_load ||= Hash.new { |hash, hash_key| hash[hash_key] = true; false }
26
+ if error.to_s[/undefined class|referred/] && !lazy_load[error.to_s.split.last.constantize] then retry
27
+ else raise error end
18
28
  end
19
29
  end
20
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seamusabshere-cache-money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Kallen