forked from p93542168/wheat-cache
feat(worker): change string to proto.KeyBase
This commit is contained in:
parent
97833ed150
commit
428a8fa8f8
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue