Module: Makara::Cache

Defined in:
lib/makara/cache.rb,
lib/makara/cache/noop_store.rb,
lib/makara/cache/memory_store.rb

Defined Under Namespace

Classes: MemoryStore, NoopStore

Class Method Summary collapse

Class Method Details

.read(key) ⇒ Object



18
19
20
# File 'lib/makara/cache.rb', line 18

def read(key)
  store.try(:read, key)
end

.store=(store) ⇒ Object



14
15
16
# File 'lib/makara/cache.rb', line 14

def store=(store)
  @store = store
end

.write(key, value, ttl) ⇒ Object



22
23
24
# File 'lib/makara/cache.rb', line 22

def write(key, value, ttl)
  store.try(:write, key, value, :expires_in => ttl.to_i)
end