edge badge
Methods
D
E
L
Constants
DATE = 'Date'.freeze
 
LAST_MODIFIED = "Last-Modified".freeze
 
SPECIAL_KEYS = Set.new(%w[extras no-cache max-age public private must-revalidate])
 
DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate".freeze
 
NO_CACHE = "no-cache".freeze
 
PUBLIC = "public".freeze
 
PRIVATE = "private".freeze
 
MUST_REVALIDATE = "must-revalidate".freeze
 
Attributes
[R] cache_control
Instance Public methods
date()
# File actionpack/lib/action_dispatch/http/cache.rb, line 69
def date
  if date_header = get_header(DATE)
    Time.httpdate(date_header)
  end
end
date=(utc_time)
# File actionpack/lib/action_dispatch/http/cache.rb, line 79
def date=(utc_time)
  set_header DATE, utc_time.httpdate
end
date?()
# File actionpack/lib/action_dispatch/http/cache.rb, line 75
def date?
  has_header? DATE
end
etag=(etag)

This method allows you to set the ETag for cached content, which will be returned to the end user.

By default, Action Dispatch sets all ETags to be weak. This ensures that if the content changes only semantically, the whole page doesn't have to be regenerated from scratch by the web server. With strong ETags, pages are compared byte by byte, and are regenerated only if they are not exactly equal.

# File actionpack/lib/action_dispatch/http/cache.rb, line 91
def etag=(etag)
  key = ActiveSupport::Cache.expand_cache_key(etag)
  super %(W/"#{Digest::MD5.hexdigest(key)}")
end
etag?()
# File actionpack/lib/action_dispatch/http/cache.rb, line 96
def etag?; etag; end
last_modified()
# File actionpack/lib/action_dispatch/http/cache.rb, line 55
def last_modified
  if last = get_header(LAST_MODIFIED)
    Time.httpdate(last)
  end
end
last_modified=(utc_time)
# File actionpack/lib/action_dispatch/http/cache.rb, line 65
def last_modified=(utc_time)
  set_header LAST_MODIFIED, utc_time.httpdate
end
last_modified?()
# File actionpack/lib/action_dispatch/http/cache.rb, line 61
def last_modified?
  has_header? LAST_MODIFIED
end