add option to skip file modification date checks if it is cached already
This commit is contained in:
parent
22ea7b35ab
commit
aaced50b76
|
@ -10,7 +10,8 @@
|
||||||
(java.io File FileNotFoundException ByteArrayOutputStream)))
|
(java.io File FileNotFoundException ByteArrayOutputStream)))
|
||||||
|
|
||||||
; global options
|
; global options
|
||||||
(defonce options (atom {:cache-compiled-templates true}))
|
(defonce options (atom {:cache-compiled-templates true
|
||||||
|
:skip-file-modification-check false}))
|
||||||
|
|
||||||
(declare flush-template-cache!)
|
(declare flush-template-cache!)
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@
|
||||||
new-compiled-template))
|
new-compiled-template))
|
||||||
cached (get @compiled-templates filepath)]
|
cached (get @compiled-templates filepath)]
|
||||||
(if (and cached
|
(if (and cached
|
||||||
(not (newer? file (:last-modified cached))))
|
(or (:skip-file-modification-check @options)
|
||||||
|
(not (newer? file (:last-modified cached)))))
|
||||||
(:template cached)
|
(:template cached)
|
||||||
(cache-and-return!))))
|
(cache-and-return!))))
|
||||||
|
|
||||||
|
|
Reference in a new issue