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.



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

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.



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

def store
  @store
end

Instance Method Details

#fetch(key) ⇒ Object



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

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