@@ -137,10 +137,17 @@ default on all operating systems, except Windows."
137137(defcustom projectile-enable-caching (eq projectile-indexing-method 'native )
138138 " When t enables project files caching.
139139
140+ Normally the cache lasts for the duration of your Emacs session.
141+ If you want to cache to persist between Emacs sessions you
142+ should set this option to `'persistent' .
143+
140144Project caching is automatically enabled by default if you're
141145using the native indexing method."
142146 :group 'projectile
143- :type 'boolean )
147+ :type '(radio
148+ (const :tag " Disabled" nil )
149+ (const :tag " Transient" t )
150+ (const :tag " Persistent" persistent)))
144151
145152(defcustom projectile-kill-buffers-filter 'kill-all
146153 " Determine which buffers are killed by `projectile-kill-buffers' .
@@ -1110,9 +1117,9 @@ to invalidate."
11101117(defun projectile-cache-project (project files )
11111118 " Cache PROJECTs FILES.
11121119The cache is created both in memory and on the hard drive."
1113- (when projectile-enable-caching
1114- (puthash project files projectile-projects-cache)
1115- ( puthash project (projectile-time-seconds) projectile-projects-cache-time )
1120+ (puthash project files projectile-projects-cache)
1121+ (puthash project (projectile-time-seconds) projectile-projects-cache-time )
1122+ ( when ( eq projectile-enable-caching 'persistent )
11161123 (projectile-serialize files (projectile-project-cache-file project))))
11171124
11181125(defun projectile-load-project-cache (project-root )
@@ -2168,7 +2175,10 @@ project-root for every file."
21682175 ; ; Use the cache, if requested and available.
21692176 (when projectile-enable-caching
21702177 (setq files (or (gethash project-root projectile-projects-cache)
2171- (projectile-load-project-cache project-root))))
2178+ ; ; load the cache from disk only if persistent cache is
2179+ ; ; enabled
2180+ (and (eq projectile-enable-caching 'persistent )
2181+ (projectile-load-project-cache project-root)))))
21722182
21732183 ; ; Calculate the list of files.
21742184 (when (null files )
0 commit comments