Method: Itrigga::Cache::ClassMethods#get_from_cache

Defined in:
lib/itrigga/cache/cache.rb

#get_from_cache(key, opts = {}) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/itrigga/cache/cache.rb', line 108

def get_from_cache(key, opts = {})
  return nil unless caching_enabled?(opts)
  cache_log "get_from_cache key: #{key},  opts: #{opts.inspect}" if opts[:debug]
  begin
    Itrigga::Cache.instance(opts).get key
  rescue Memcached::NotFound => not_found
    # we dont care 
    nil
  rescue Exception => e
    cache_log "Exception in get_from_cache: #{e.message}"
    nil
  end
end