Source
(defmethod make-room-in-cache ((cache standard-cache))
;; We need to remove some objects from the in-memory cache (both
;; from the hash table and from the queue).
;; We do this by removing the objects that have been used least
;; recently. We don't do anything with dirty objects, because
;; they contain changes that must still be committed to disk.
(let ((queue (queue cache))
(nr-objects-to-remove (* (- 1.0 (cache-shrink-ratio cache))
(cache-size cache)))
(nr-objects-removed 0))
(loop until (or (= nr-objects-removed nr-objects-to-remove)
(queue-empty-p queue))
do (let ((id (queue-remove queue)))
(when (remhash id (objects cache))
(incf nr-objects-removed))))))
Source Context