Method: Itrigga::Cache::ClassMethods#set_to_cache

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

#set_to_cache(key, value, opts = {}) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/itrigga/cache/cache.rb', line 124

def set_to_cache(key, value, opts = {})
  raise "Cache not Enabled" unless caching_enabled?(opts)
        
  cache_log "set_to_cache key: #{key}, value: #{value}, opts: #{opts.inspect}" if opts[:debug]
  begin
    Itrigga::Cache.instance(opts).set key, value, opts
  rescue Exception => e
    cache_log "Exception in set_to_cache: #{e.message}"
  end
    
  value
end