Class: JekyllIncludeCache::Tag

Inherits:
Jekyll::Tags::IncludeTag
  • Object
show all
Defined in:
lib/jekyll-include-cache/tag.rb

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jekyll-include-cache/tag.rb', line 7

def render(context)
  path   = path(context)
  params = parse_params(context) if @params
  return unless path

  key    = key(path, params)
  cached = JekyllIncludeCache.cache[key]

  if cached
    Jekyll.logger.debug "Include cache hit:", path
    cached
  else
    Jekyll.logger.debug "Include cache miss:", path
    JekyllIncludeCache.cache[key] = super
  end
end