Method: (CACHE-GET-OBJECT T STANDARD-CACHE)

Source

(defmethod cache-get-object (object-id (cache standard-cache))
  (let* ((transaction (current-transaction))
         (result
          (or
           ;; Unmodified, already loaded and compatible with the
           ;; current transaction?  Fine, let's use it.
           (let ((object (gethash object-id (objects cache))))
             (and object
                  (or (null transaction)
                      (<= (transaction-id object) (transaction-id transaction)))
                  object))
           ;; Modified by an open transaction?  Try to find the
           ;; 'compatible' version.
           (find-object-version object-id transaction cache)
           ;; Not in memory at all? Then load the compatible version
           ;; from disk.
           (multiple-value-bind (object most-recent-p)
               (load-object object-id transaction cache)
             (when most-recent-p
               ;; Add to in-memory cache if the loaded object is
               ;; the most recent version of the object.
               (when (cache-full-p cache)
                 (make-room-in-cache cache))
               (setf (gethash object-id (objects cache)) object))
             object))))
    ;; Put it (back) in front of the queue, so we know which
    ;; objects were recently used when we need to make room
    ;; in the cache.
    ;; DO: If this object was already in the queue, we should remove it
    ;; from the old position.  But that's too expensive: so we actually
    ;; need a better data structure than a simple queue.
    (add-to-queue object-id cache)
    result))
Source Context