Skip to content

Commit 9056912

Browse files
author
Libo Cannici
committed
Add caching mechanism on compilation
1 parent c08047d commit 9056912

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/curly/template_handler.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ class << self
1515
# Returns a String containing the Ruby code representing the template.
1616
def call(template)
1717
instrument(template) do
18-
compile(template)
18+
if Curly.configuration.cache_store
19+
cache_key = [
20+
"CurlyCompilation",
21+
template.virtual_path,
22+
template.cache_key,
23+
].join("/")
24+
25+
Curly.configuration.cache_store.fetch(cache_key) do
26+
compile(template)
27+
end
28+
else
29+
compile(template)
30+
end
1931
end
2032
end
2133

0 commit comments

Comments
 (0)