Module: Immunio::CacheStoreHooks

Extended by:
ActiveSupport::Concern
Defined in:
lib/immunio/plugins/action_view/cache_store.rb

Instance Method Summary collapse

Instance Method Details

#write_with_immunio(name, value, options = nil) ⇒ Object

Rails 5 adds CollectionCaching. When used in the context of rendering a collection of items with a partial template, we need to remove our markers before writing to the cache store. See this blog post for more: blog.bigbinary.com/2016/03/09/rails-5-makes-partial-redering-from-cache-substantially-faster.html



14
15
16
17
18
19
20
21
22
# File 'lib/immunio/plugins/action_view/cache_store.rb', line 14

def write_with_immunio(name, value, options = nil)
  Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
    Template.remove_all_markers! value if value.is_a? String

    Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
      write_without_immunio(name, value, options)
    end
  end
end