Module: CacheByPage::PageExtensions::ClassMethods

Defined in:
lib/cache_by_page/page_extensions.rb

Instance Method Summary collapse

Instance Method Details

#default_cachingObject



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cache_by_page/page_extensions.rb', line 70

def default_caching
  seconds = SiteController.respond_to?('cache_timeout') ? SiteController.cache_timeout : ResponseCache.defaults[:expire_time] 
  cache_expire_time = case true
    when seconds >= 86400 then "#{seconds/86400} days"
    when seconds >= 3600 then "#{seconds/3600} hours"
    when seconds >= 120 then "#{seconds/60} minutes"
    else "#{seconds} seconds"
  end
  cache_expire_time = cache_expire_time.chop if cache_expire_time[0,1] == "1"
  cache_expire_time
end