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

This commit is contained in:
Liang Ding 2022-11-18 00:11:13 +08:00
parent fcf7856431
commit fee4811031
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

View File

@ -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
} }