From 239da8522dcf942e0ac1dbbdde6a839908f33ef6 Mon Sep 17 00:00:00 2001 From: David Botton Date: Sun, 16 Nov 2025 15:19:14 -0500 Subject: [PATCH] faster connection-cache --- source/clog-base.lisp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/clog-base.lisp b/source/clog-base.lisp index dee8763..ca04e3a 100644 --- a/source/clog-base.lisp +++ b/source/clog-base.lisp @@ -147,9 +147,15 @@ flushed with FLUSH-CONNECTION-CACHE or a query is made." (defun flush-connection-cache (clog-obj) "Flush connection cache if on CLOG-OBJ is located on." (when *connection-cache* - (dolist (script (reverse *connection-cache*)) - (unless (eq script :cache) - (clog-connection:execute (connection-id clog-obj) script))) + (let ((big (make-string-output-stream))) + (write-string "(function(){" big) + (dolist (script (reverse *connection-cache*)) + (unless (eq script :cache) + (write-string script big) + (write-char #\; big))) + (write-string "})()" big) + (clog-connection:execute (connection-id clog-obj) + (get-output-stream-string big))) (setf *connection-cache* (list :cache)))) ;;;;;;;;;;;;;