rename cache related functions to better indicate they have side-effects

This commit is contained in:
Gered 2014-03-02 14:14:47 -05:00
parent 7b949c176f
commit e423a658b3

View file

@ -45,7 +45,7 @@
true
(> file-last-modified other-timestamp))))
(defn- get-cached-compiled-template [^File file create-fn]
(defn- cache-compiled-template! [^File file create-fn]
(let [filepath (.getPath file)
cache-and-return! (fn []
(let [new-compiled-template (create-fn file)]
@ -62,10 +62,10 @@
(:template cached)
(cache-and-return!))))
(defn- get-compiled-template [^File file]
(defn- compile-template! [^File file]
(if-not (.exists file)
(throw (new FileNotFoundException (str "Template file \"" file "\" not found.")))
(get-cached-compiled-template
(cache-compiled-template!
file
(fn [file]
(compile-template-file file)))))
@ -150,7 +150,7 @@
"renders a template from a file, using the values in model-map as the model for the template"
[filename model-map & [options]]
(let [file (new File filename)
compiled-template (get-compiled-template file)]
compiled-template (compile-template! file)]
(render-compiled-template compiled-template model-map options)))
(defn render-resource