Use persistent-soft's native TTL expiration

Don't need to reinvent the wheel.
This commit is contained in:
Henrik Lissner 2017-05-26 11:20:22 +02:00
parent 8615bf23ca
commit 42a63c661b

View file

@ -9,17 +9,11 @@
(doom-initialize) (doom-initialize)
(when (or force-p (getenv "DEBUG")) (when (or force-p (getenv "DEBUG"))
(doom-refresh-clear-cache)) (doom-refresh-clear-cache))
(let ((last-refresh (persistent-soft-fetch 'last-pkg-refresh "emacs"))) (unless (persistent-soft-fetch 'last-pkg-refresh "emacs")
(when last-refresh
(setq doom--last-refresh last-refresh)))
(when (or (not doom--last-refresh)
(> (nth 1 (time-since doom--last-refresh)) 900))
(condition-case ex (condition-case ex
(progn (progn
(package-refresh-contents) (package-refresh-contents)
(persistent-soft-store (persistent-soft-store 'last-pkg-refresh t "emacs" 900))
'last-pkg-refresh (setq doom--last-refresh (current-time))
"emacs"))
('error ('error
(doom-refresh-clear-cache))))) (doom-refresh-clear-cache)))))