Class: Cacher

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
app/liquid/tags/rails_tags.rb

Overview

cache “some_key” %

...

endcache %

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ Cacher

Returns a new instance of Cacher.



6
7
8
9
# File 'app/liquid/tags/rails_tags.rb', line 6

def initialize(tag_name, markup, tokens)
  super
  @key= markup.to_s
end

Instance Method Details

#render(context) ⇒ Object



11
12
13
14
15
# File 'app/liquid/tags/rails_tags.rb', line 11

def render(context)
  Rails.cache.fetch(@key) do
    super
  end
end