1

I've tried adding new behaviour to Dalli, which is the cache store I'm using:

class ActiveSupport::Cache::DalliStore

  def fetch(name, options = {})
    if options[:cache]==false
      yield
    else
      super(name, options) { yield }
    end
  end

end

I can't make it apply however. This is in a library file required in application.rb. If it's run before 'rails/all', ActiveSupport doesn't exist. If applied after, it seems like Rails.cache has already been assigned, so extending the class has no effect. I've also tried manually assigning Rails.cache to a new instance of it, but it doesn't seem to have any effect either.

How to make this apply to Rails.cache?

Siguza
  • 21,155
  • 6
  • 52
  • 89
mahemoff
  • 44,526
  • 36
  • 160
  • 222

0 Answers0