Class: Nanoc3::Extra::CHiCk::CacheController
CHiCk::CacheController sets the Cache-Control header (and more specifically, max-age) to limit the number of necessary requests.
Constructor Summary
public
initialize(app, options = {})
[View source]
61 62 63 64 |
# File 'lib/nanoc3/extra/chick.rb', line 61 def initialize(app, ={}) @app = app = end |
Public Visibility
Public Instance Method Summary
| #call(env) |
|---|
Public Instance Method Details
call
public
call(env)
[View source]
66 67 68 69 70 71 72 |
# File 'lib/nanoc3/extra/chick.rb', line 66 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 |