Class: Alephant::Broker::LoadStrategy::Revalidate::Strategy
- Inherits:
-
Object
- Object
- Alephant::Broker::LoadStrategy::Revalidate::Strategy
- Includes:
- Logger
- Defined in:
- lib/alephant/broker/load_strategy/revalidate/strategy.rb
Constant Summary collapse
- STORAGE_ERRORS =
[Alephant::Broker::Errors::ContentNotFound].freeze
Instance Method Summary collapse
Instance Method Details
#load(component_meta) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/alephant/broker/load_strategy/revalidate/strategy.rb', line 17 def load() loaded_content = cached_object() update_content() if loaded_content.expired? data = loaded_content.to_h data.fetch(:meta, {})[:status] = 200 add_revalidating_headers(data) if loaded_content.expired? data rescue *STORAGE_ERRORS update_content() { content: '', content_type: 'text/html', meta: { status: 202 } } end |