Function: projectile-define-project-cache
projectile-define-project-cache is a macro defined in projectile.el.
Signature
(projectile-define-project-cache NAME DOCSTRING &rest PROPS)
Documentation
Define NAME as a per-project cache table documented by DOCSTRING.
The table is keyed by project root (with test equal) and is wired
into projectile--invalidate-project-cache and the test sandbox
automatically. PROPS may contain :prefix-keyed t for tables whose
keys are directories under a project rather than the root itself;
invalidation then drops every entry under the invalidated root.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defmacro projectile-define-project-cache (name docstring &rest props)
"Define NAME as a per-project cache table documented by DOCSTRING.
The table is keyed by project root (with test `equal') and is wired
into `projectile--invalidate-project-cache' and the test sandbox
automatically. PROPS may contain `:prefix-keyed t' for tables whose
keys are directories under a project rather than the root itself;
invalidation then drops every entry under the invalidated root."
(declare (indent 1) (doc-string 2))
`(progn
(defvar ,name (make-hash-table :test 'equal) ,docstring)
(add-to-list 'projectile--project-cache-vars ',name)
(projectile--register-project-cache-cleanup
',name
,(if (plist-get props :prefix-keyed)
`(lambda (project-root)
(dolist (key (hash-table-keys ,name))
(when (string-prefix-p project-root key)
(remhash key ,name))))
`(lambda (project-root) (remhash project-root ,name))))
',name))