🐛 偶发编辑文档标题后引用处的动态锚文本不更新 Fix https://github.com/siyuan-note/siyuan/issues/5891

This commit is contained in:
Liang Ding 2022-09-26 20:54:22 +08:00
parent a8560b365b
commit 5861be23ee
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 18 additions and 4 deletions

View file

@ -93,6 +93,8 @@ func ClearVirtualRefKeywords() {
memCache.Del("virtual_ref")
}
var defIDRefsCache = gcache.New(30*time.Minute, 5*time.Minute) // [defBlockID]map[refBlockID]*Ref
func GetRefsCacheByDefID(defID string) (ret []*Ref) {
for defBlockID, refs := range defIDRefsCache.Items() {
if defBlockID == defID {
@ -110,8 +112,6 @@ func GetRefsCacheByDefID(defID string) (ret []*Ref) {
return
}
var defIDRefsCache = gcache.New(30*time.Minute, 5*time.Minute) // [defBlockID]map[refBlockID]*Ref
func CacheRef(tree *parse.Tree, refNode *ast.Node) {
ref := buildRef(tree, refNode)
putRefCache(ref)