class Protocol::HTTP::Header::CacheControl
Represents the ‘cache-control` header, which is a list of cache directives.
def << value
Adds a directive to the Cache-Control header. The value will be normalized to lowercase before being added.
def << value super(value.downcase) end
def dynamic?
def dynamic? self.include?(DYNAMIC) end
def find_integer_value(value_name)
@parameter value_name [String] the directive name to search for (e.g., "max-age").
Finds and parses an integer value from a directive.
def find_integer_value(value_name) if value = self.find { |value| value.start_with?(value_name) } _, age = value.split("=", 2) if age =~ /\A[0-9]+\z/ return Integer(age) end end end
def initialize(value = nil)
Initializes the cache control header with the given value. The value is expected to be a comma-separated string of cache directives.
def initialize(value = nil) super(value&.downcase) end
def max_age
def max_age find_integer_value(MAX_AGE) end
def must_revalidate?
def must_revalidate? self.include?(MUST_REVALIDATE) end
def no_cache?
def no_cache? self.include?(NO_CACHE) end
def no_store?
def no_store? self.include?(NO_STORE) end
def private?
def private? self.include?(PRIVATE) end
def proxy_revalidate?
def proxy_revalidate? self.include?(PROXY_REVALIDATE) end
def public?
def public? self.include?(PUBLIC) end
def s_maxage
def s_maxage find_integer_value(S_MAXAGE) end
def static?
def static? self.include?(STATIC) end
def streaming?
def streaming? self.include?(STREAMING) end