Module: BackgroundCache
- Defined in:
- lib/background_cache.rb,
lib/background_cache/client.rb,
lib/background_cache/config.rb,
lib/background_cache/daemon.rb,
lib/background_cache/helper.rb,
lib/background_cache/mem_cache.rb,
lib/background_cache/controller.rb
Defined Under Namespace
Modules: Controller, Helper, Memcache
Classes: AppInstance, Client, Config, Daemon
Class Method Summary
collapse
Class Method Details
.cache!(group = nil, instance = nil) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/background_cache.rb', line 49
def self.cache!(group=nil, instance=nil)
unless instance
instance = self.boot
end
BackgroundCache::Config.load!(group)
caches = BackgroundCache::Config.caches
caches.each do |cache|
next if group && cache[:group] != group
self.manual(cache, instance)
end
end
|
.manual(cache, instance = nil) ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/background_cache.rb', line 61
def self.manual(cache, instance=nil)
ENV['BACKGROUND_CACHE'] = '1'
unless instance
instance = self.boot
end
BackgroundCache::Config.current_cache = cache
url = cache[:path] || instance.url_for(cache[:params].merge(:only_path => true))
puts "(#{cache[:group]}) #{url}"
instance.get(url)
BackgroundCache::Config.current_cache = nil
url
end
|
.match?(fragment = {}) ⇒ Boolean