Class: Protocol::HTTP::Header::CacheControl
- Defined in:
- lib/protocol/http/header/cache_control.rb
Constant Summary collapse
- PRIVATE =
'private'- PUBLIC =
'public'- NO_CACHE =
'no-cache'- NO_STORE =
'no-store'- MAX_AGE =
'max-age'- S_MAXAGE =
's-maxage'- STATIC =
'static'- DYNAMIC =
'dynamic'- STREAMING =
'streaming'- MUST_REVALIDATE =
'must-revalidate'- PROXY_REVALIDATE =
'proxy-revalidate'
Constants inherited from Split
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #dynamic? ⇒ Boolean
-
#initialize(value = nil) ⇒ CacheControl
constructor
A new instance of CacheControl.
-
#max_age ⇒ Object
The maximum time, in seconds, a response should be considered fresh.
-
#must_revalidate? ⇒ Boolean
Indicates that a response must not be used once it is stale.
- #no_cache? ⇒ Boolean
- #no_store? ⇒ Boolean
- #private? ⇒ Boolean
-
#proxy_revalidate? ⇒ Boolean
Like must-revalidate, but for shared caches only.
- #public? ⇒ Boolean
-
#s_maxage ⇒ Object
Like max-age, but for shared caches only, which should use it before max-age when present.
- #static? ⇒ Boolean
- #streaming? ⇒ Boolean
Methods inherited from Split
Constructor Details
#initialize(value = nil) ⇒ CacheControl
Returns a new instance of CacheControl.
27 28 29 |
# File 'lib/protocol/http/header/cache_control.rb', line 27 def initialize(value = nil) super(value&.downcase) end |
Instance Method Details
#<<(value) ⇒ Object
31 32 33 |
# File 'lib/protocol/http/header/cache_control.rb', line 31 def << value super(value.downcase) end |
#dynamic? ⇒ Boolean
39 40 41 |
# File 'lib/protocol/http/header/cache_control.rb', line 39 def dynamic? self.include?(DYNAMIC) end |
#max_age ⇒ Object
The maximum time, in seconds, a response should be considered fresh. See www.rfc-editor.org/rfc/rfc9111.html#name-max-age-2
77 78 79 |
# File 'lib/protocol/http/header/cache_control.rb', line 77 def max_age find_integer_value(MAX_AGE) end |
#must_revalidate? ⇒ Boolean
Indicates that a response must not be used once it is stale. See www.rfc-editor.org/rfc/rfc9111.html#name-must-revalidate
65 66 67 |
# File 'lib/protocol/http/header/cache_control.rb', line 65 def must_revalidate? self.include?(MUST_REVALIDATE) end |
#no_cache? ⇒ Boolean
55 56 57 |
# File 'lib/protocol/http/header/cache_control.rb', line 55 def no_cache? self.include?(NO_CACHE) end |
#no_store? ⇒ Boolean
59 60 61 |
# File 'lib/protocol/http/header/cache_control.rb', line 59 def no_store? self.include?(NO_STORE) end |
#private? ⇒ Boolean
47 48 49 |
# File 'lib/protocol/http/header/cache_control.rb', line 47 def private? self.include?(PRIVATE) end |
#proxy_revalidate? ⇒ Boolean
Like must-revalidate, but for shared caches only. See www.rfc-editor.org/rfc/rfc9111.html#name-proxy-revalidate
71 72 73 |
# File 'lib/protocol/http/header/cache_control.rb', line 71 def proxy_revalidate? self.include?(PROXY_REVALIDATE) end |
#public? ⇒ Boolean
51 52 53 |
# File 'lib/protocol/http/header/cache_control.rb', line 51 def public? self.include?(PUBLIC) end |
#s_maxage ⇒ Object
Like max-age, but for shared caches only, which should use it before max-age when present. See www.rfc-editor.org/rfc/rfc9111.html#name-s-maxage
84 85 86 |
# File 'lib/protocol/http/header/cache_control.rb', line 84 def s_maxage find_integer_value(S_MAXAGE) end |
#static? ⇒ Boolean
35 36 37 |
# File 'lib/protocol/http/header/cache_control.rb', line 35 def static? self.include?(STATIC) end |
#streaming? ⇒ Boolean
43 44 45 |
# File 'lib/protocol/http/header/cache_control.rb', line 43 def streaming? self.include?(STREAMING) end |