浏览代码

:art: 虚拟引用关键字缓存调整为 10 分钟 Fix https://github.com/siyuan-note/siyuan/issues/6602

Liang Ding 2 年之前
父节点
当前提交
fee4811031
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      kernel/sql/cache.go

+ 7 - 0
kernel/sql/cache.go

@@ -70,11 +70,18 @@ func removeBlockCache(id string) {
 	removeRefCacheByDefID(id)
 	removeRefCacheByDefID(id)
 }
 }
 
 
+var virtualRefKeywordsCacheTime = time.Now()
+
 func getVirtualRefKeywordsCache() ([]string, bool) {
 func getVirtualRefKeywordsCache() ([]string, bool) {
 	if disabled {
 	if disabled {
 		return nil, false
 		return nil, false
 	}
 	}
 
 
+	if 10 < time.Now().Sub(virtualRefKeywordsCacheTime).Minutes() {
+		ClearVirtualRefKeywords()
+		return nil, false
+	}
+
 	if val, ok := memCache.Get("virtual_ref"); ok {
 	if val, ok := memCache.Get("virtual_ref"); ok {
 		return val.([]string), true
 		return val.([]string), true
 	}
 	}