[Add clon timer to control the size of the markdown cache clinton@unknownlamer.org**20081217090615 Attempts to reduce the size to at most 50 entries every hour ] hunk ./src/site-control.lisp 31 +(defvar *markdown-cache-size-limit* 50) +(defvar *markdown-cache-collector* nil) + +(defun markdown-cache-collector () + (let ((count (hash-table-count beesknees.pages::*markdown-output-cache*))) + (when (> count *markdown-cache-size-limit*) + (with-hash-table-iterator (next beesknees.pages::*markdown-output-cache*) + (dotimes (i (- count *markdown-cache-size-limit*)) + (multiple-value-bind (foundp key value) + (next) + (declare (ignore foundp value)) + (remhash key beesknees.pages::*markdown-output-cache*))))))) + hunk ./src/site-control.lisp 45 + (setf *markdown-cache-collector* + (clon:schedule-function + #'markdown-cache-collector + (clon:make-scheduler (clon:make-typed-cron-schedule :hour '*)) + :thread t :name "markdown cache collector")) hunk ./src/site-control.lisp 68 +(defmethod stop-site :after ((site bee-site)) + (when *markdown-cache-collector* + (trivial-timers:unschedule-timer *markdown-cache-collector*) + (setf *markdown-cache-collector* nil))) +