improve caching logic

This commit is contained in:
Konstantin Haase 2012-10-23 22:00:06 +02:00
parent ca47b31904
commit 778acbf275

View File

@ -14,10 +14,11 @@ module Travis::Api::App::Responders
private
def cache_control
return unless final? # FIXME
mode = [endpoint.public? ? :public : :private]
mode << :must_revalidate #unless final?
endpoint.expires(31536000, *mode) # 1 year
if final?
mode = endpoint.public? ? :public : :private
endpoint.expires(31536000, mode, :must_revalidate) # 1 year
end
endpoint.etag resource.cache_key if cache_key?
endpoint.last_modified resource.updated_at if updated_at?
end