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

#initializeCache

Returns a new instance of Cache.



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

def initialize
  @lightly = Lightly.new dir: "tmp/fcc_#{@service}_data", life: '3d', hash: true
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

#fetch(key) ⇒ Object



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

def fetch key
  @lightly.get key.to_s do
    puts "loading up cache with all results"
    yield
  end
end