Class: Nanoc3::Extra::CHiCk::CacheController Deprecated

Inherits:
Object
  • Object
show all
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

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, options={})
  @app = app
  @options = 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