Class: FCC::Station::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/fcc/station/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ Cache

Returns a new instance of Cache.



10
11
12
13
# File 'lib/fcc/station/cache.rb', line 10

def initialize(service)
  @service = service
  @store = Station::ExtendedInfo.new(@service)
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



8
9
10
# File 'lib/fcc/station/cache.rb', line 8

def store
  @store
end

Instance Method Details

#find(fcc_id) ⇒ Object



15
16
17
# File 'lib/fcc/station/cache.rb', line 15

def find(fcc_id)
  results.detect { |r| r[:fcc_id].to_s == fcc_id.to_s }
end

#inspectObject



24
25
26
# File 'lib/fcc/station/cache.rb', line 24

def inspect
  "<Cache @service=#{service}>"
end

#resultsObject



19
20
21
22
# File 'lib/fcc/station/cache.rb', line 19

def results
  #TODO: add redis caching tie-in because this query is molasses
  @store.all_results.parsed_response
end