Class: FaradayCdnMetrics::ServerCaches::Fastly
- Inherits:
-
Object
- Object
- FaradayCdnMetrics::ServerCaches::Fastly
- Defined in:
- lib/faraday_cdn_metrics/server_caches/fastly.rb
Instance Method Summary collapse
- #hit? ⇒ Boolean
- #hit_while_revalidate? ⇒ Boolean
-
#initialize(response_headers = {}) ⇒ Fastly
constructor
A new instance of Fastly.
- #miss? ⇒ Boolean
- #pass? ⇒ Boolean
Constructor Details
#initialize(response_headers = {}) ⇒ Fastly
Returns a new instance of Fastly.
6 7 8 |
# File 'lib/faraday_cdn_metrics/server_caches/fastly.rb', line 6 def initialize(response_headers = {}) @response_headers = response_headers end |
Instance Method Details
#hit? ⇒ Boolean
10 11 12 |
# File 'lib/faraday_cdn_metrics/server_caches/fastly.rb', line 10 def hit? x_cache_hit? end |
#hit_while_revalidate? ⇒ Boolean
22 23 24 25 26 27 |
# File 'lib/faraday_cdn_metrics/server_caches/fastly.rb', line 22 def hit_while_revalidate? max_age = fetch_max_age.to_i age = fetch_age.to_i x_cache_hit? && max_age > 0 && age > max_age end |
#miss? ⇒ Boolean
14 15 16 |
# File 'lib/faraday_cdn_metrics/server_caches/fastly.rb', line 14 def miss? x_cache_miss? end |
#pass? ⇒ Boolean
18 19 20 |
# File 'lib/faraday_cdn_metrics/server_caches/fastly.rb', line 18 def pass? x_cache_miss? && fetch_age.nil? end |