require 'mustache'

class MustacheView < Mustache
  def partial(name)
    File.read("#{template_path}/#{name}.#{template_extension}")
  end
end

require 'mustache'

class MustacheView < Mustache

  def initialize
    super
    @partial_cache = {}
  end

  def partial(name)
    @partial_cache[name] ||= File.read("#{template_path}/#{name}.#{template_extension}")
  end
end

Add naive caching to partials
Add naive caching to partials

This commit adds caching to partials to reduce the number of disk reads
when the same partial is used more than once. The mustache gem still
does a lot of repeated CPU intensive work parsing the partial so I
would still advise against using partials inside loops until this
problem has been addressed in the mustache gem.
