Class: FCC::Station::Cache
- Inherits:
-
Object
- Object
- FCC::Station::Cache
- Defined in:
- lib/fcc/station/cache.rb
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #fetch(key) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize ⇒ Cache
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
#store ⇒ Object (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 |