diff options
-rw-r--r-- | sx-cache.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sx-cache.el b/sx-cache.el index a564a53..b668213 100644 --- a/sx-cache.el +++ b/sx-cache.el @@ -73,23 +73,28 @@ DATA will be written as returned by `prin1'." VARS is a list of variables to unbind to ensure cache is cleared. If INIT-METHOD is defined, call it after all invalidation to re-initialize the cache." - (sx-cache-set cache nil) + (let ((file (sx-cache-get-file-name cache))) + (delete-file file)) (mapc #'makunbound vars) - (funcall init-method)) + (when init-method + (funcall init-method))) (defun sx-cache-invalidate-all (&optional save-auth) "Invalidate all caches using `sx-cache--invalidate'. Afterwards reinitialize caches using `sx-initialize'. +Note: This will also remove read/unread status of questions as well +as delete the list of hidden questions. + If SAVE-AUTH is non-nil, do not clear AUTH cache." - (let ((caches (let ((default-directory sx-cache-directory)) - (file-expand-wildcards "*.el")))) + (let* ((default-directory sx-cache-directory) + (caches (file-expand-wildcards "*.el"))) (when save-auth (setq caches (cl-remove-if (lambda (x) - (string= x "auth.el")) caches))) + (string= x "auth.el")) caches))) (lwarn 'stack-mode :debug "Invalidating: %S" caches) - (mapc #'sx-cache--invalidate caches) + (mapc #'delete-file caches) (sx-initialize 'force))) (provide 'sx-cache) |