From 6f902003195726be98e6961111bcf0e9251a9023 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 2 Oct 2007 10:43:38 +0200 Subject: Cache JOURNAL-MARKUP->HTML results. darcs-hash:20405a72f26b378da02c00680fb61382e3e64ab9 --- journal-content.lisp | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'journal-content.lisp') diff --git a/journal-content.lisp b/journal-content.lisp index 43947d6..6529b57 100644 --- a/journal-content.lisp +++ b/journal-content.lisp @@ -192,26 +192,28 @@ (defun journal-markup->html (markup) - (if (string= "" markup) - markup - (handler-bind - ((error ;; method-call-type-error or not - ;; Work around a weird bug in cl-markdown or CLISP. (I - ;; don't know which.) - #'(lambda (c) - (declare (ignore c)) - #+nil (<:as-html - (with-output-to-string (s) - (system::pretty-print-condition c s))) - (invoke-restart 'return nil)))) - (fixup-markdown-output - (with-output-to-string (s) - ;; Normally, we shouldn't need to create our own stream to - ;; write into, but this is, of course, yet another - ;; CLISP/Markdown hack, because Markdown's default - ;; *OUTPUT-STREAM* seems to spontaneously close itself, making - ;; everything break when Markdown tries to render more stuff. - (markdown markup :stream s)))))) + (with-result-cache ((format nil "markup-~A" (sxhash markup)) + :younger-than (compute-script-last-modified-date)) + (if (string= "" markup) + markup + (handler-bind + ((error ;; method-call-type-error or not + ;; Work around a weird bug in cl-markdown or CLISP. (I + ;; don't know which.) + #'(lambda (c) + (declare (ignore c)) + #+nil (<:as-html + (with-output-to-string (s) + (system::pretty-print-condition c s))) + (invoke-restart 'return nil)))) + (fixup-markdown-output + (with-output-to-string (s) + ;; Normally, we shouldn't need to create our own stream to + ;; write into, but this is, of course, yet another + ;; CLISP/Markdown hack, because Markdown's default + ;; *OUTPUT-STREAM* seems to spontaneously close itself, making + ;; everything break when Markdown tries to render more stuff. + (markdown markup :stream s))))))) (defun compute-journal-last-modified-date () -- cgit v1.2.3