Module: Notificon::Cache

Included in:
UserStateStore
Defined in:
lib/notificon/cache.rb

Instance Method Summary collapse

Instance Method Details

#cache_delete(key) ⇒ Object



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

def cache_delete(key)
  Notificon.cache.delete("notificon_#{key}") if cache_enabled?
end

#cache_enabled?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/notificon/cache.rb', line 6

def cache_enabled?
  Notificon.cache
end

#cache_fetch(key) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/notificon/cache.rb', line 10

def cache_fetch(key)
  if cache_enabled?
    Notificon.cache.fetch("notificon_#{key}") { yield }
  else
    yield
  end
end