(feature): add a cache for ROAM_KEY (#192)

This commit is contained in:
Jethro Kuan
2020-02-26 22:26:02 +08:00
committed by GitHub
parent 962ef23cce
commit 92d25b287e
4 changed files with 31 additions and 10 deletions

View File

@ -72,7 +72,8 @@
(oset obj initialized t)
(oset obj forward-links (plist-get cache :forward))
(oset obj backward-links (plist-get cache :backward))
(oset obj titles (plist-get cache :titles)))))
(oset obj titles (plist-get cache :titles))
(oset obj refs (plist-get cache :refs)))))
;;; Tests
(describe "org-roam--build-cache-async"
@ -92,6 +93,7 @@
(expect (hash-table-count (org-roam--forward-links-cache)) :to-be 4)
(expect (hash-table-count (org-roam--backward-links-cache)) :to-be 5)
(expect (hash-table-count (org-roam--titles-cache)) :to-be 6)
(expect (hash-table-count (org-roam--refs-cache)) :to-be 1)
;; Forward cache
(let ((f1 (gethash (abs-path "f1.org")
@ -148,6 +150,10 @@
(expect (gethash (abs-path "no-title.org")
(org-roam--titles-cache)) :to-be nil)
;; Refs Cache
(expect (gethash "https://google.com/"
(org-roam--refs-cache)) :to-equal (abs-path "web_ref.org"))
;; Multi
(let ((org-roam-directory org-roam-directory2))
(org-roam--build-cache-async)