Skip to content

Commit

Permalink
⬆️ Upgrade kernel deps
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Sep 22, 2024
1 parent 0aaa429 commit c765bcc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions kernel/cache/ial.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/dgraph-io/ristretto"
)

var docIALCache, _ = ristretto.NewCache(&ristretto.Config{
var docIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
NumCounters: 1024 * 100,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
Expand All @@ -40,7 +40,7 @@ func GetDocIAL(p string) (ret map[string]string) {
}

ret = map[string]string{}
for k, v := range ial.(map[string]string) {
for k, v := range ial {
ret[k] = strings.ReplaceAll(v, editor.IALValEscNewLine, "\n")
}
return
Expand All @@ -54,7 +54,7 @@ func ClearDocsIAL() {
docIALCache.Clear()
}

var blockIALCache, _ = ristretto.NewCache(&ristretto.Config{
var blockIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
NumCounters: 1024 * 1000,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
Expand All @@ -69,7 +69,7 @@ func GetBlockIAL(id string) (ret map[string]string) {
if nil == ial {
return
}
return ial.(map[string]string)
return ial
}

func RemoveBlockIAL(id string) {
Expand Down
2 changes: 1 addition & 1 deletion kernel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sashabaranov/go-openai v1.29.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/siyuan-note/dejavu v0.0.0-20240922022610-033cc35db309
github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
github.com/siyuan-note/filelock v0.0.0-20240724034355-d1ed7bf21d04
Expand Down
4 changes: 2 additions & 2 deletions kernel/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,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-20240922022610-033cc35db309 h1:jo6rn0qK4YEXlRvNrZzHC/zdOErCNh61ad57EO8O0ow=
github.com/siyuan-note/dejavu v0.0.0-20240922022610-033cc35db309/go.mod h1:3Hl2ttBIdfRMhzJ+WEvbuYokL3JLSMj8jObn96hrWt4=
github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9 h1:TRIWGA/sP4T2eAEJSNpNhct8iGHDIGyXEtSnq2FYnwQ=
github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9/go.mod h1:3Hl2ttBIdfRMhzJ+WEvbuYokL3JLSMj8jObn96hrWt4=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=
Expand Down
6 changes: 3 additions & 3 deletions kernel/model/virutalref.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (

// virtualBlockRefCache 用于保存块关联的虚拟引用关键字。
// 改进打开虚拟引用后加载文档的性能 https://github.com/siyuan-note/siyuan/issues/7378
var virtualBlockRefCache, _ = ristretto.NewCache(&ristretto.Config{
var virtualBlockRefCache, _ = ristretto.NewCache[string, []string](&ristretto.Config[string, []string]{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
Expand All @@ -60,7 +60,7 @@ func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) {
ret = putBlockVirtualRefKeywords(content, root)
return
}
ret = val.([]string)
ret = val
return
}

Expand Down Expand Up @@ -216,7 +216,7 @@ func getVirtualRefKeywords(root *ast.Node) (ret []string) {
}

if val, ok := virtualBlockRefCache.Get("virtual_ref"); ok {
ret = val.([]string)
ret = val
}

if "" != strings.TrimSpace(Conf.Editor.VirtualBlockRefInclude) {
Expand Down
4 changes: 2 additions & 2 deletions kernel/sql/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func disableCache() {
cacheDisabled = true
}

var blockCache, _ = ristretto.NewCache(&ristretto.Config{
var blockCache, _ = ristretto.NewCache[string, *Block](&ristretto.Config[string, *Block]{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
Expand Down Expand Up @@ -67,7 +67,7 @@ func getBlockCache(id string) (ret *Block) {

b, _ := blockCache.Get(id)
if nil != b {
ret = b.(*Block)
ret = b
}
return
}
Expand Down

0 comments on commit c765bcc

Please sign in to comment.