diff --git a/kernel/cache/ial.go b/kernel/cache/ial.go index 7d536ad6a..2cb72c03c 100644 --- a/kernel/cache/ial.go +++ b/kernel/cache/ial.go @@ -23,7 +23,7 @@ import ( "github.com/dgraph-io/ristretto" ) -var docIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{ +var docIALCache, _ = ristretto.NewCache(&ristretto.Config{ NumCounters: 1024 * 100, MaxCost: 1024 * 1024 * 200, BufferItems: 64, @@ -40,7 +40,7 @@ func GetDocIAL(p string) (ret map[string]string) { } ret = map[string]string{} - for k, v := range ial { + for k, v := range ial.(map[string]string) { ret[k] = strings.ReplaceAll(v, editor.IALValEscNewLine, "\n") } return @@ -54,7 +54,7 @@ func ClearDocsIAL() { docIALCache.Clear() } -var blockIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{ +var blockIALCache, _ = ristretto.NewCache(&ristretto.Config{ NumCounters: 1024 * 1000, MaxCost: 1024 * 1024 * 200, BufferItems: 64, @@ -69,7 +69,7 @@ func GetBlockIAL(id string) (ret map[string]string) { if nil == ial { return } - return ial + return ial.(map[string]string) } func RemoveBlockIAL(id string) { diff --git a/kernel/go.mod b/kernel/go.mod index edb78c818..d4541a9a7 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -52,13 +52,13 @@ require ( github.com/open-spaced-repetition/go-fsrs/v3 v3.3.1 github.com/panjf2000/ants/v2 v2.11.3 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/pdfcpu/pdfcpu v0.9.1 + github.com/pdfcpu/pdfcpu v0.10.2 github.com/radovskyb/watcher v1.0.7 github.com/rqlite/sql v0.0.0-20241111133259-a4122fabb196 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sashabaranov/go-openai v1.38.2 github.com/shirou/gopsutil/v4 v4.25.3 - github.com/siyuan-note/dejavu v0.0.0-20250425040734-cf778a44b27b + github.com/siyuan-note/dejavu v0.0.0-20250425041744-41d516f57836 github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 github.com/siyuan-note/filelock v0.0.0-20250227145141-7d111cdf3c57 diff --git a/kernel/go.sum b/kernel/go.sum index 2caa49bbb..407282bb1 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -377,8 +377,8 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= -github.com/siyuan-note/dejavu v0.0.0-20250425040734-cf778a44b27b h1:Bq0gjcc+L3QRkZcGk2xLwjo13AeTORTLUriP4Gbhw4w= -github.com/siyuan-note/dejavu v0.0.0-20250425040734-cf778a44b27b/go.mod h1:LoravhILz8sW38zPd73xpw//fyJHbKW/gFRGA6U3e3A= +github.com/siyuan-note/dejavu v0.0.0-20250425041744-41d516f57836 h1:utRFKPUkVGkYogO6QVXfDYtHC6QjjJo0Tb1xkjqIGbE= +github.com/siyuan-note/dejavu v0.0.0-20250425041744-41d516f57836/go.mod h1:LoravhILz8sW38zPd73xpw//fyJHbKW/gFRGA6U3e3A= github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec h1:D8Sjwa+7WxP3XrIBscT4PxBZZddZ83/O+5nX1sq6g6g= github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec/go.mod h1:6iAxXPOOAG3+M4bCiKQZTQ+n4gSUx/OyHhsP57dJlS8= github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8= diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.go index 1ad3018a1..e769ded35 100644 --- a/kernel/model/virutalref.go +++ b/kernel/model/virutalref.go @@ -38,7 +38,7 @@ import ( // virtualBlockRefCache 用于保存块关联的虚拟引用关键字。 // 改进打开虚拟引用后加载文档的性能 https://github.com/siyuan-note/siyuan/issues/7378 -var virtualBlockRefCache, _ = ristretto.NewCache[string, []string](&ristretto.Config[string, []string]{ +var virtualBlockRefCache, _ = ristretto.NewCache(&ristretto.Config{ NumCounters: 102400, MaxCost: 10240, BufferItems: 64, @@ -61,7 +61,7 @@ func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) { ret = putBlockVirtualRefKeywords(content, root) return } - ret = val + ret = val.([]string) return } @@ -217,7 +217,7 @@ func getVirtualRefKeywords(root *ast.Node) (ret []string) { } if val, ok := virtualBlockRefCache.Get("virtual_ref"); ok { - ret = val + ret = val.([]string) } if "" != strings.TrimSpace(Conf.Editor.VirtualBlockRefInclude) { diff --git a/kernel/sql/cache.go b/kernel/sql/cache.go index 28b334494..9fe4e15ae 100644 --- a/kernel/sql/cache.go +++ b/kernel/sql/cache.go @@ -39,7 +39,7 @@ func disableCache() { cacheDisabled = true } -var blockCache, _ = ristretto.NewCache[string, *Block](&ristretto.Config[string, *Block]{ +var blockCache, _ = ristretto.NewCache(&ristretto.Config{ NumCounters: 102400, MaxCost: 10240, BufferItems: 64, @@ -71,7 +71,7 @@ func getBlockCache(id string) (ret *Block) { b, _ := blockCache.Get(id) if nil != b { - ret = b + ret = b.(*Block) } return }