Module: ActionDispatch::Http::Cache::Response
- Defined in:
- actionpack/lib/action_dispatch/http/cache.rb
Constant Summary
- DEFAULT_CACHE_CONTROL =
"max-age=0, private, must-revalidate"
Instance Attribute Summary (collapse)
-
- (Object) cache_control
readonly
Returns the value of attribute cache_control.
-
- (Object) etag
(also: #etag?)
Returns the value of attribute etag.
Instance Method Summary (collapse)
-
- (Response) initialize
A new instance of Response.
- - (Object) last_modified
- - (Object) last_modified=(utc_time)
- - (Boolean) last_modified?
Instance Attribute Details
- (Object) cache_control (readonly)
Returns the value of attribute cache_control
42 43 44 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 42 def cache_control @cache_control end |
- (Object) etag Also known as: etag?
Returns the value of attribute etag
42 43 44 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 42 def etag @etag end |
Instance Method Details
- (Response) initialize
A new instance of Response
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 45 def initialize(*) super @cache_control = {} @etag = self["ETag"] if cache_control = self["Cache-Control"] cache_control.split(/,\s*/).each do |segment| first, last = segment.split("=") @cache_control[first.to_sym] = last || true end end end |
- (Object) last_modified
59 60 61 62 63 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 59 def last_modified if last = headers['Last-Modified'] Time.httpdate(last) end end |
- (Object) last_modified=(utc_time)
69 70 71 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 69 def last_modified=(utc_time) headers['Last-Modified'] = utc_time.httpdate end |
- (Boolean) last_modified?
65 66 67 |
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 65 def last_modified? headers.include?('Last-Modified') end |