Method: Cyclid::UI::Memcache#cache

Defined in:
app/cyclid_ui/memcache.rb

#cache(key) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'app/cyclid_ui/memcache.rb', line 21

def cache(key)
  begin
    output = memcached.get(key)
  rescue Memcached::NotFound
    output = yield
    memcached.set(key, output, @expiry)
  end
  output
end