This does not speed up the file caching but it saves the manual step of having to invalidate the stale cache (which does not contain the new file).
Projectile automatically invalidates the cache if the /your/projectile/project/root/.projectile
file is newer than the project cache file.
This check is done whenever you try to find any file in the project using projectile; projectile-find-file
or C-c p f
if one of the commands that does this check first.
(defun projectile-maybe-invalidate-cache (force)
"Invalidate if FORCE or project's dirconfig newer than cache."
(when (or force (file-newer-than-file-p (projectile-dirconfig-file)
projectile-cache-file))
(projectile-invalidate-cache nil)))
- From projectile.el
source - lines 575-579
So the solution is to touch
the .projectile
file when you update the project. For example, you can alias
the git commit
, git pull
, etc to do
touch /your/projectile/project/root/.projectile`
after doing whatever you were doing with the git
commands.
So if someone in your team adds a new file to the project and (assuming you are using git to version control) you use your special aliased git pull, the cache will be invalidated automatically when you do projectile-find-file
the next time.