Class: Alephant::Broker::LoadStrategy::S3::Base

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

Direct Known Subclasses

Archived, Sequenced

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



14
15
16
# File 'lib/alephant/broker/load_strategy/s3/base.rb', line 14

def initialize
  @cached = true
end

Instance Attribute Details

#cachedObject

Returns the value of attribute cached.



12
13
14
# File 'lib/alephant/broker/load_strategy/s3/base.rb', line 12

def cached
  @cached
end

Instance Method Details

#load(component_meta) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/alephant/broker/load_strategy/s3/base.rb', line 18

def load(component_meta)
  add_s3_headers(
    fetch_object(component_meta),
    component_meta
  )
rescue
  logger.metric "S3CacheMiss"
  add_s3_headers(
    cache.set(
      storage_key(component_meta),
      retrieve_object(component_meta)
    ),
    component_meta
  )
end