config/initializers/core_extensions.rb
# options is there so that we can pass in the :serialize => true option in the cases where we were using Yaml...
# I am going to try NOT doing anything with that option right now, to see if it works.  If not, however, I want
# to at least have it passed in when we needed it, so the code can change later if needed.
options is there so that we can pass in the :serialize => true option in the cases where we were using Yaml
I am going to try NOT doing anything with that option right now, to see if it works.  If not, however, I want
to at least have it passed in when we needed it, so the code can change later if needed.
options is there so that we can pass in the : serialize = > true option in the cases where we were using Yaml I am going to try NOT doing anything with that option right now to see if it works . If not however I want to at least have it passed in when we needed it so the code can change later if needed .
def cached(key, options = {}, &block)
        name = cached_name_for(key)
        if Rails.cache 
          if v = Rails.cache.read(name)
            return v
          else
            EOL.log("Cache miss: #{name}") if EOL.respond_to?(:log)
            Rails.cache.delete(name) if Rails.cache.exist?(name)
            Rails.cache.fetch(name) do
              data_to_cache = yield
              if data_to_cache.is_a?(ActiveRecord::Relation)
                data_to_cache = data_to_cache.all
              end
              data_to_cache
            end
          end
        else
          yield
        end
      end
def cached ( key , options = { } , & block ) name = cached_name_for ( key ) if Rails . cache if v = Rails . cache . read ( name ) return v else EOL . log ( "Cache miss: #{name}" ) if EOL . respond_to? ( :log ) Rails . cache . delete ( name ) if Rails . cache . exist? ( name ) Rails . cache . fetch ( name ) do data_to_cache = yield if data_to_cache . is_a? ( ActiveRecord :: Relation ) data_to_cache = data_to_cache . all end data_to_cache end end else yield end end
options is there so that we can pass in the :serialize => true option in the cases where we were using Yaml...
options is there so that we can pass in the : serialize = > true option in the cases where we were using Yaml ...
# Sometimes during tests, cache has not yet been initialized.
key
<not_specific>
options
<not_specific>
block
<not_specific>