lib/extensions/http.rb in radiospieler-0.3.12 vs lib/extensions/http.rb in radiospieler-2012.09.13
- old
+ new
@@ -11,18 +11,21 @@
module Http
extend self
# the default expiration time for get requests.
module MaxAge
+ DEFAULT_MAX_AGE = 86_400
+
def self.config
@config ||= (App.config["cache-max-age"] || {}).to_a
end
def self.for(url)
config.each do |pattern, max_age|
return max_age if url.index(pattern)
end
- nil
+
+ DEFAULT_MAX_AGE
end
end
def get(url, max_age = nil)
body, headers = get_body_and_headers(url, max_age)