[Ephemeral cached query-view clinton@unknownlamer.org**20080723221540] { hunk ./src/query-view.lisp 30 - ((reverse :accessor reversep :initform nil :initarg :reverse))) + ((reverse :accessor reversep :initform nil :initarg :reverse) + (%cache :initform nil :documentation "cons of current request and + cached instances. For internal use only."))) hunk ./src/query-view.lisp 66 - (query-view-get-instances view (minimum-item view) (maximum-item view) + ;; This uses an ephemeral cache that survives only for the + ;; request. It seems reasonable to ensure that the request has a + ;; consistent view of the database, and this makes uncached views + ;; usable. + (labels ((cache-valid-p (view) + (with-slots (%cache) view + (and %cache (eq (car %cache) (context.request *context*))))) + (update-cache (view) + (with-slots (%cache) view + (setf %cache + (cons (context.request *context*) + (query-view-get-instances + view (minimum-item view) (maximum-item view) hunk ./src/query-view.lisp 80 - :from-end (reversep view))) + :from-end (reversep view))))))) + (if (cache-valid-p view) + (cdr (slot-value view '%cache)) + (cdr (update-cache view))))) hunk ./src/query-view.lisp 96 +;; Extension mixins hunk ./src/query-view.lisp 229 - (view cached-query-paged-view-mixin)) + (view cached-query-paged-view-mixin)) }