feat(worker): change string to proto.KeyBase

This commit is contained in:
HuangJiaLuo 2021-10-06 20:39:52 +08:00
parent 97833ed150
commit 428a8fa8f8
1 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package lru
import ( import (
"context" "context"
"gitee.com/timedb/wheatCache/pkg/event" "gitee.com/timedb/wheatCache/pkg/event"
"gitee.com/timedb/wheatCache/pkg/proto"
"gitee.com/timedb/wheatCache/pkg/structure/stringx" "gitee.com/timedb/wheatCache/pkg/structure/stringx"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing" "testing"
@ -16,9 +17,11 @@ func TestWorker(t *testing.T) {
workEvent := event.NewEvent(OptionEventName) workEvent := event.NewEvent(OptionEventName)
workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) { workEvent.SetValue(WorkFuncEventKey, event.EventWorkFunc(func() (interface{}, error) {
v1 := stringx.NewStringSingle() v1 := stringx.NewStringSingle()
key := "v1" key := proto.BaseKey{
Key: "v1",
}
res, _ := v1.Set("123") res, _ := v1.Set("123")
lru.Add(key, v1) lru.Add(&key, v1)
return res, nil return res, nil
})) }))
workEvent.InitWaitEvent() workEvent.InitWaitEvent()