Class: Alephant::Broker::LoadStrategy::Revalidate::Fetcher

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/alephant/broker/load_strategy/revalidate/fetcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component_meta) ⇒ Fetcher

Returns a new instance of Fetcher.



12
13
14
# File 'lib/alephant/broker/load_strategy/revalidate/fetcher.rb', line 12

def initialize(component_meta)
  @component_meta = component_meta
end

Instance Attribute Details

#component_metaObject (readonly)

Returns the value of attribute component_meta.



10
11
12
# File 'lib/alephant/broker/load_strategy/revalidate/fetcher.rb', line 10

def component_meta
  @component_meta
end

Instance Method Details

#fetchObject



16
17
18
19
20
21
22
# File 'lib/alephant/broker/load_strategy/revalidate/fetcher.rb', line 16

def fetch
  Alephant::Broker::Cache::CachedObject.new(s3.get(s3_path))
rescue Aws::S3::Errors::NoSuchKey, InvalidCacheKey => error
  logger.error(event: 'InvalidCacheKeyErrorCaught', method: "#{self.class}#fetch", error: error)
  logger.metric 'S3InvalidCacheKey'
  raise Alephant::Broker::Errors::ContentNotFound
end