Module: Wwwtf

Defined in:
lib/wwwtf/http.rb,
lib/wwwtf.rb,
lib/wwwtf/cache.rb,
lib/wwwtf/version.rb,
lib/wwwtf/http/url.rb,
lib/wwwtf/cache/king.rb,
lib/wwwtf/utils/time.rb

Overview

Wwwtf::Utils::Time

Defined Under Namespace

Modules: Cache, HTTP, UtilsTime

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.cache_king(url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wwwtf.rb', line 11

def self.cache_king(url)
  cache_stat = Wwwtf::Cache::King.stat url
  lm_median_hrs = cache_stat['last_modified_hours_median'].to_i
  lm_median_days = lm_median_hrs / 24
  puts "#{url} has:
        #{cache_stat['total_count']} number of dependent content locations,
        #{cache_stat['cache_control%']}% of it is Cache-Control decisive,
        #{cache_stat['expire_in_day%']}% of cached expires within a day,
        #{cache_stat['last_modified%']}% is aware of Last-Modified,
        #{lm_median_hrs}hrs. (i.e. #{lm_median_days} days) is L-M median
       "
  puts "\tDependent URLs:\n\t#{cache_stat['page_urls'].join("\n\t")}\n" unless ENV['WWWTF_DEBUG'].nil?
end