Skip to content

Commit

Permalink
Add caching mechanism on compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Libo Cannici committed Apr 27, 2015
1 parent c08047d commit 9056912
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/curly/template_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@ class << self
# Returns a String containing the Ruby code representing the template.
def call(template)
instrument(template) do
compile(template)
if Curly.configuration.cache_store
cache_key = [
"CurlyCompilation",
template.virtual_path,
template.cache_key,
].join("/")

Curly.configuration.cache_store.fetch(cache_key) do
compile(template)
end
else
compile(template)
end
end
end

Expand Down

0 comments on commit 9056912

Please sign in to comment.