Class Rack::Cache::Request

  1. lib/rack/cache/request.rb
Parent: Rack::Request

Provides access to the HTTP request. The request and original_request objects exposed by the Core caching engine are instances of this class.

Request objects respond to a variety of convenience methods, including everything defined by Rack::Request as well as the Headers and RequestHeaders modules.

Methods

public instance

  1. cache_control
  2. no_cache?
  3. request_method

Public instance methods

cache_control ()

A CacheControl instance based on the request’s Cache-Control header.

[show source]
    # File lib/rack/cache/request.rb, line 22
22:     def cache_control
23:       @cache_control ||= CacheControl.new(env['HTTP_CACHE_CONTROL'])
24:     end
no_cache? ()

True when the Cache-Control/no-cache directive is present or the Pragma header is set to no-cache.

[show source]
    # File lib/rack/cache/request.rb, line 28
28:     def no_cache?
29:       cache_control['no-cache'] ||
30:         env['HTTP_PRAGMA'] == 'no-cache'
31:     end
request_method ()

The HTTP request method. This is the standard implementation of this method but is respecified here due to libraries that attempt to modify the behavior to respect POST tunnel method specifiers. We always want the real request method.

[show source]
    # File lib/rack/cache/request.rb, line 17
17:     def request_method
18:       @env['REQUEST_METHOD']
19:     end