Method: Allgood::CacheStore#write

Defined in:
lib/allgood/cache_store.rb

#write(key, value) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/allgood/cache_store.rb', line 21

def write(key, value)
  if rails_cache_available?
    expiry = key.include?('day') ? 1.day : 1.hour
    Rails.cache.write(key, value, expires_in: expiry)
  else
    @memory_store[key] = value
  end
end