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.
- data/lib/cache_money.rb +1 -1
- data/lib/cash/local.rb +11 -1
- metadata +1 -1
data/lib/cache_money.rb
CHANGED
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
|
-
|
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
|
|