Class: Dragonfly::Cache::Plugin
- Inherits:
-
Object
- Object
- Dragonfly::Cache::Plugin
- Extended by:
- Forwardable
- Defined in:
- lib/dragonfly/cache/plugin.rb
Constant Summary collapse
- @@servers =
{}
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
18 19 20 |
# File 'lib/dragonfly/cache/plugin.rb', line 18 def config @config end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
18 19 20 |
# File 'lib/dragonfly/cache/plugin.rb', line 18 def manager @manager end |
Instance Method Details
#call(app, cache_servers_options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dragonfly/cache/plugin.rb', line 22 def call(app, = {}) @config = Dragonfly::Cache::Config.new() @manager = Dragonfly::Cache::Manager.new(self) app.define_url do |same, job, opts| url_for(same, job, opts) rescue Dragonfly::Cache::Error => e Dragonfly.warn(e.) app.server.url_for(job, opts) # Fallback to default Dragonfly::App url building end end |
#url_for(app, job, opts) ⇒ Object
34 35 36 |
# File 'lib/dragonfly/cache/plugin.rb', line 34 def url_for(app, job, opts) cache(job) { build_url_for(app, job, opts) } end |