Class Index [+]

Quicksearch

ActionDispatch::Http::Cache::Response

Constants

LAST_MODIFIED
ETAG
CACHE_CONTROL
DEFAULT_CACHE_CONTROL
NO_CACHE
PUBLIC
PRIVATE
MUST_REVALIDATE

Attributes

cache_control[R]
etag[R]

Public Instance Methods

etag=(etag) click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 63
63:         def etag=(etag)
64:           key = ActiveSupport::Cache.expand_cache_key(etag)
65:           @etag = self[ETAG] = %("#{Digest::MD5.hexdigest(key)}")
66:         end
last_modified() click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 49
49:         def last_modified
50:           if last = headers[LAST_MODIFIED]
51:             Time.httpdate(last)
52:           end
53:         end
last_modified=(utc_time) click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 59
59:         def last_modified=(utc_time)
60:           headers[LAST_MODIFIED] = utc_time.httpdate
61:         end
last_modified?() click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 55
55:         def last_modified?
56:           headers.include?(LAST_MODIFIED)
57:         end

Private Instance Methods

handle_conditional_get!() click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 86
86:         def handle_conditional_get!
87:           if etag? || last_modified? || !@cache_control.empty?
88:             set_conditional_cache_control!
89:           end
90:         end
prepare_cache_control!() click to toggle source
    # File lib/action_dispatch/http/cache.rb, line 74
74:         def prepare_cache_control!
75:           @cache_control = {}
76:           @etag = self[ETAG]
77: 
78:           if cache_control = self[CACHE_CONTROL]
79:             cache_control.split(/,\s*/).each do |segment|
80:               first, last = segment.split("=")
81:               @cache_control[first.to_sym] = last || true
82:             end
83:           end
84:         end
set_conditional_cache_control!() click to toggle source
     # File lib/action_dispatch/http/cache.rb, line 98
 98:         def set_conditional_cache_control!
 99:           return if self[CACHE_CONTROL].present?
100: 
101:           control = @cache_control
102: 
103:           if control.empty?
104:             headers[CACHE_CONTROL] = DEFAULT_CACHE_CONTROL
105:           elsif control[:no_cache]
106:             headers[CACHE_CONTROL] = NO_CACHE
107:           else
108:             extras  = control[:extras]
109:             max_age = control[:max_age]
110: 
111:             options = []
112:             options << "max-age=#{max_age.to_i}" if max_age
113:             options << (control[:public] ? PUBLIC : PRIVATE)
114:             options << MUST_REVALIDATE if control[:must_revalidate]
115:             options.concat(extras) if extras
116: 
117:             headers[CACHE_CONTROL] = options.join(", ")
118:           end
119:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.