arc cache
This commit is contained in:
parent
49f1e4f345
commit
c496c0269a
1 changed files with 3 additions and 9 deletions
|
@ -7,8 +7,7 @@ import (
|
|||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/dgraph-io/ristretto"
|
||||
lru "github.com/hashicorp/golang-lru/v2"
|
||||
"github.com/hashicorp/golang-lru/arc/v2"
|
||||
"github.com/royalcat/ctxio"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
@ -35,16 +34,11 @@ type block struct {
|
|||
len int
|
||||
}
|
||||
|
||||
var blockCache *lru.Cache[blockIndex, block]
|
||||
|
||||
func ChangeBufferSize(blockCount int) {
|
||||
blockCache.Resize(blockCount)
|
||||
}
|
||||
var blockCache *arc.ARCCache[blockIndex, block]
|
||||
|
||||
func init() {
|
||||
ristretto.NewCache(&ristretto.Config{})
|
||||
var err error
|
||||
blockCache, err = lru.New[blockIndex, block](defaultBlockCount)
|
||||
blockCache, err = arc.NewARC[blockIndex, block](defaultBlockCount)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue