Module: Http::MaxAge

Defined in:
lib/extensions/http.rb

Overview

the default expiration time for get requests.

Class Method Summary collapse

Class Method Details

.configObject



13
14
15
# File 'lib/extensions/http.rb', line 13

def self.config
  @config ||= (App.config["cache-max-age"] || {}).to_a
end

.for(url) ⇒ Object



17
18
19
20
21
22
# File 'lib/extensions/http.rb', line 17

def self.for(url)
  config.each do |pattern, max_age|
    return max_age if url.index(pattern)
  end
  nil
end