Sha256: fe2e756baf9504f8be9e5d8ef5caf9bee913bef867e1e235e1ead076f9cb6c18
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'alephant/broker/errors' module Alephant module Broker module LoadStrategy module Revalidate class Fetcher include Logger attr_reader :component_meta def initialize(component_meta) @component_meta = component_meta end 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 private def s3_path lookup_read = lookup.read(component_meta.id, component_meta.options, 1) raise InvalidCacheKey if lookup_read.location.nil? lookup_read.location end def s3 @s3 ||= Alephant::Storage.new( Broker.config[:s3_bucket_id], Broker.config[:s3_object_path] ) end def lookup @lookup ||= Alephant::Lookup.create( Broker.config[:lookup_table_name], Broker.config ) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alephant-broker-3.19.1 | lib/alephant/broker/load_strategy/revalidate/fetcher.rb |
alephant-broker-3.19.0 | lib/alephant/broker/load_strategy/revalidate/fetcher.rb |