disable template cache in interactive session

dev-output-files-201008
Matthew Butterick 4 years ago
parent 123547f3cb
commit d96a9d9809

@ -1 +1 @@
1595187053
1599432650

@ -409,13 +409,7 @@
[(->output-path source-path)]
[else #false]))
(define key (template-cache-key source-path output-path))
(hash-ref! ram-cache
;; within a session, this will prevent repeat players like "template.html.p"
;; from hitting the file cache repeatedly
key
(λ ()
(cache-ref! key
(λ ()
(define (cache-thunk)
(match source-path
[(or (? markup-source?) (? markdown-source?))
;; output-path may not have an extension
@ -427,7 +421,14 @@
get-default-template
get-fallback-template)])
(file-exists-or-has-source? (proc source-path output-path-ext)))]
[_ #false]))))))
[_ #false]))
(if (current-session-interactive?)
;; don't cache templates in interactive session, for fresher reloads
;; this makes it possible to add template and have it show up in next render
(cache-thunk)
;; otherwise, within a rendering session, this will prevent repeat players like "template.html.p"
;; from hitting the file cache repeatedly
(hash-ref! ram-cache key (λ () (cache-ref! key cache-thunk)))))
(module-test-external
(require pollen/setup sugar/file sugar/coerce)

Loading…
Cancel
Save