Function: projectile--schedule-cache-flush

projectile--schedule-cache-flush is a byte-compiled function defined in projectile.el.

Signature

(projectile--schedule-cache-flush PROJECT)

Documentation

Arrange for PROJECT's in-memory cache to be serialized after Emacs is idle.

A pending flush for the same PROJECT is cancelled and rescheduled, so that adding several files in quick succession only results in a single disk write, and the write always uses the latest in-memory contents.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--schedule-cache-flush (project)
  "Arrange for PROJECT's in-memory cache to be serialized after Emacs is idle.
A pending flush for the same PROJECT is cancelled and rescheduled, so that
adding several files in quick succession only results in a single disk write,
and the write always uses the latest in-memory contents."
  (when-let* ((existing (gethash project projectile--pending-cache-flush-timers)))
    (cancel-timer existing))
  (puthash project
           (run-with-idle-timer
            30 nil
            (lambda ()
              (remhash project projectile--pending-cache-flush-timers)
              (projectile-serialize
               (gethash project projectile-projects-cache)
               (projectile-project-cache-file project))))
           projectile--pending-cache-flush-timers))