Class: Nanoc3::Extra::CHiCk::CacheController Deprecated
- Inherits:
-
Object
- Object
- Nanoc3::Extra::CHiCk::CacheController
- Defined in:
- lib/nanoc3/extra/chick.rb
Overview
Deprecated.
Use a HTTP library such as [Net::HTTP](ruby-doc.org/stdlib/libdoc/net/http/rdoc/) or [Curb](curb.rubyforge.org/) instead.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ CacheController
constructor
A new instance of CacheController.
Constructor Details
#initialize(app, options = {}) ⇒ CacheController
Returns a new instance of CacheController.
66 67 68 69 |
# File 'lib/nanoc3/extra/chick.rb', line 66 def initialize(app, ={}) @app = app @options = end |
Instance Method Details
#call(env) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/nanoc3/extra/chick.rb', line 71 def call(env) res = @app.call(env) unless res[1].has_key?('Cache-Control') || res[1].has_key?('Expires') res[1]['Cache-Control'] = "max-age=#{@options[:max_age]}" end res end |