Module: Simple::HTTP::Caching

Extended by:
Caching
Included in:
Caching
Defined in:
lib/simple/http/caching.rb

Overview

This file is part of the simple-http ruby gem.

Copyright © 2011 - 2015 @radiospiel Distributed under the terms of the modified BSD license, see LICENSE.BSD

Instance Method Summary collapse

Instance Method Details

#determine_expires_in(response) ⇒ Object

returns expiration information, in seconds from now.



11
12
13
14
15
16
17
18
# File 'lib/simple/http/caching.rb', line 11

def determine_expires_in(response)
  return nil unless cacheable_status?(response.status)

  expires_in = parse_cache_control response
  expires_in ||= parse_expires response

  return expires_in if expires_in && expires_in > 0
end