class GdsApi::JsonClient
def response_cache_time(response)
Return either a Time object representing the expiry time of the response
def response_cache_time(response) if response.headers[:cache_control] cache_control = Rack::Cache::CacheControl.new(response.headers[:cache_control]) if cache_control.private? || cache_control.no_cache? || cache_control.no_store? Time.now.utc elsif cache_control.max_age Time.now.utc + cache_control.max_age end elsif response.headers[:expires] Time.httpdate response.headers[:expires] end end