Class: Nanoc::Extra::CHiCk::CacheController Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/extra/chick.rb

Overview

Deprecated.

Use a HTTP library such as Net::HTTP or Curb instead.

Instance Method Summary (collapse)

Constructor Details

- (CacheController) initialize(app, options = {})

Returns a new instance of CacheController



66
67
68
69
# File 'lib/nanoc/extra/chick.rb', line 66

def initialize(app, options={})
  @app = app
  @options = options
end

Instance Method Details

- (Object) call(env)



71
72
73
74
75
76
77
# File 'lib/nanoc/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