chore(service): update service

This commit is contained in:
bandl 2021-11-11 22:46:39 +08:00
parent 55204575d7
commit 60de1a6ae9
1 changed files with 133 additions and 133 deletions

View File

@ -5,7 +5,7 @@ package service
import (
context "context"
"gitee.com/wheat-os/wheatCache/pkg/event"
"gitee.com/wheat-os/wheatCache/pkg/event2"
"gitee.com/wheat-os/wheatCache/pkg/lru"
"gitee.com/wheat-os/wheatCache/pkg/proto"
)
@ -14,7 +14,7 @@ func (s *singleService) LIndex(
ctx context.Context,
req *proto.LIndexRequest,
) (*proto.LIndexResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LIndex(req.Key, req.Index)
if err != nil {
return nil, err
@ -27,10 +27,10 @@ func (s *singleService) LIndex(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -42,7 +42,7 @@ func (s *singleService) LLen(
ctx context.Context,
req *proto.LLenRequest,
) (*proto.LLenResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LLen(req.Key)
if err != nil {
return nil, err
@ -55,10 +55,10 @@ func (s *singleService) LLen(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -70,7 +70,7 @@ func (s *singleService) LPop(
ctx context.Context,
req *proto.LPopRequest,
) (*proto.LPopResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LPop(req.Key, req.Count)
if err != nil {
return nil, err
@ -83,10 +83,10 @@ func (s *singleService) LPop(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -98,7 +98,7 @@ func (s *singleService) LPush(
ctx context.Context,
req *proto.LPushRequest,
) (*proto.LPushResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LPush(req.Key, req.Values)
if err != nil {
return nil, err
@ -111,10 +111,10 @@ func (s *singleService) LPush(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -126,7 +126,7 @@ func (s *singleService) LPushX(
ctx context.Context,
req *proto.LPushXRequest,
) (*proto.LPushXResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LPushX(req.Key, req.Values)
if err != nil {
return nil, err
@ -139,10 +139,10 @@ func (s *singleService) LPushX(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -154,7 +154,7 @@ func (s *singleService) LRange(
ctx context.Context,
req *proto.LRangeRequest,
) (*proto.LRangeResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LRange(req.Key, req.Start, req.End)
if err != nil {
return nil, err
@ -167,10 +167,10 @@ func (s *singleService) LRange(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -182,7 +182,7 @@ func (s *singleService) LRem(
ctx context.Context,
req *proto.LRemRequest,
) (*proto.LRemResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LRem(req.Key, req.Count, req.Value)
if err != nil {
return nil, err
@ -195,10 +195,10 @@ func (s *singleService) LRem(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -210,7 +210,7 @@ func (s *singleService) LSet(
ctx context.Context,
req *proto.LSetRequest,
) (*proto.LSetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LSet(req.Key, req.Index, req.Value)
if err != nil {
return nil, err
@ -223,10 +223,10 @@ func (s *singleService) LSet(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -238,7 +238,7 @@ func (s *singleService) RPop(
ctx context.Context,
req *proto.RPopRequest,
) (*proto.RPopResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.RPop(req.Key, req.Count)
if err != nil {
return nil, err
@ -251,10 +251,10 @@ func (s *singleService) RPop(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -266,7 +266,7 @@ func (s *singleService) LTrim(
ctx context.Context,
req *proto.LTrimRequest,
) (*proto.LTrimResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.LTrim(req.Key, req.Start, req.End)
if err != nil {
return nil, err
@ -279,10 +279,10 @@ func (s *singleService) LTrim(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -294,7 +294,7 @@ func (s *singleService) RPush(
ctx context.Context,
req *proto.RPushRequest,
) (*proto.RPushResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.RPush(req.Key, req.Values)
if err != nil {
return nil, err
@ -307,10 +307,10 @@ func (s *singleService) RPush(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -322,7 +322,7 @@ func (s *singleService) RPushX(
ctx context.Context,
req *proto.RPushXRequest,
) (*proto.RPushXResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.RPushX(req.Key, req.Values)
if err != nil {
return nil, err
@ -335,10 +335,10 @@ func (s *singleService) RPushX(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -350,7 +350,7 @@ func (s *singleService) HDel(
ctx context.Context,
req *proto.HDelRequest,
) (*proto.HDelResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HDel(req.Key, req.HKeys)
if err != nil {
return nil, err
@ -363,10 +363,10 @@ func (s *singleService) HDel(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -378,7 +378,7 @@ func (s *singleService) HExists(
ctx context.Context,
req *proto.HExistsRequest,
) (*proto.HExistsResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HExists(req.Key, req.HKey)
if err != nil {
return nil, err
@ -391,10 +391,10 @@ func (s *singleService) HExists(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -406,7 +406,7 @@ func (s *singleService) HGet(
ctx context.Context,
req *proto.HGetRequest,
) (*proto.HGetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HGet(req.Key, req.HKeys)
if err != nil {
return nil, err
@ -419,10 +419,10 @@ func (s *singleService) HGet(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -434,7 +434,7 @@ func (s *singleService) HGetAll(
ctx context.Context,
req *proto.HGetAllRequest,
) (*proto.HGetAllResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HGetAll(req.Key)
if err != nil {
return nil, err
@ -447,10 +447,10 @@ func (s *singleService) HGetAll(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -462,7 +462,7 @@ func (s *singleService) HIncrBy(
ctx context.Context,
req *proto.HIncrByRequest,
) (*proto.HIncrByResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HIncrBy(req.Key, req.HKeys, req.Renewal)
if err != nil {
return nil, err
@ -475,10 +475,10 @@ func (s *singleService) HIncrBy(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -490,7 +490,7 @@ func (s *singleService) HKeys(
ctx context.Context,
req *proto.HKeysRequest,
) (*proto.HKeysResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HKeys(req.Key)
if err != nil {
return nil, err
@ -503,10 +503,10 @@ func (s *singleService) HKeys(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -518,7 +518,7 @@ func (s *singleService) HLen(
ctx context.Context,
req *proto.HLenRequest,
) (*proto.HLenResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HLen(req.Key)
if err != nil {
return nil, err
@ -531,10 +531,10 @@ func (s *singleService) HLen(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -546,7 +546,7 @@ func (s *singleService) HSet(
ctx context.Context,
req *proto.HSetRequest,
) (*proto.HSetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HSet(req.Key, req.Items)
if err != nil {
return nil, err
@ -559,10 +559,10 @@ func (s *singleService) HSet(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -574,7 +574,7 @@ func (s *singleService) HSetX(
ctx context.Context,
req *proto.HSetXRequest,
) (*proto.HSetXResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.HSetX(req.Key, req.Items)
if err != nil {
return nil, err
@ -587,10 +587,10 @@ func (s *singleService) HSetX(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -602,7 +602,7 @@ func (s *singleService) Set(
ctx context.Context,
req *proto.SetRequest,
) (*proto.SetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.Set(req.Key, req.Val)
if err != nil {
return nil, err
@ -615,10 +615,10 @@ func (s *singleService) Set(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -630,7 +630,7 @@ func (s *singleService) Get(
ctx context.Context,
req *proto.GetRequest,
) (*proto.GetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.Get(req.Key)
if err != nil {
return nil, err
@ -643,10 +643,10 @@ func (s *singleService) Get(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -658,7 +658,7 @@ func (s *singleService) Add(
ctx context.Context,
req *proto.AddRequest,
) (*proto.AddResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.Add(req.Key, req.Renewal)
if err != nil {
return nil, err
@ -671,10 +671,10 @@ func (s *singleService) Add(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -686,7 +686,7 @@ func (s *singleService) Reduce(
ctx context.Context,
req *proto.ReduceRequest,
) (*proto.ReduceResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.Reduce(req.Key, req.Renewal)
if err != nil {
return nil, err
@ -699,10 +699,10 @@ func (s *singleService) Reduce(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -714,7 +714,7 @@ func (s *singleService) Setnx(
ctx context.Context,
req *proto.SetnxRequest,
) (*proto.SetnxResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.Setnx(req.Key, req.Val)
if err != nil {
return nil, err
@ -727,10 +727,10 @@ func (s *singleService) Setnx(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -742,7 +742,7 @@ func (s *singleService) SetBit(
ctx context.Context,
req *proto.SetBitRequest,
) (*proto.SetBitResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SetBit(req.Key, req.Val, req.Offer)
if err != nil {
return nil, err
@ -755,10 +755,10 @@ func (s *singleService) SetBit(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -770,7 +770,7 @@ func (s *singleService) GetBit(
ctx context.Context,
req *proto.GetBitRequest,
) (*proto.GetBitResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.GetBit(req.Key, req.Offer)
if err != nil {
return nil, err
@ -783,10 +783,10 @@ func (s *singleService) GetBit(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -798,7 +798,7 @@ func (s *singleService) GetRange(
ctx context.Context,
req *proto.GetRangeRequest,
) (*proto.GetRangeResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.GetRange(req.Key, req.Start, req.End)
if err != nil {
return nil, err
@ -811,10 +811,10 @@ func (s *singleService) GetRange(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -826,7 +826,7 @@ func (s *singleService) GetSet(
ctx context.Context,
req *proto.GetSetRequest,
) (*proto.GetSetResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.GetSet(req.Key, req.Val)
if err != nil {
return nil, err
@ -839,10 +839,10 @@ func (s *singleService) GetSet(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -854,7 +854,7 @@ func (s *singleService) StrLen(
ctx context.Context,
req *proto.StrLenRequest,
) (*proto.StrLenResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.StrLen(req.Key)
if err != nil {
return nil, err
@ -867,10 +867,10 @@ func (s *singleService) StrLen(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -882,7 +882,7 @@ func (s *singleService) SAdd(
ctx context.Context,
req *proto.SAddRequest,
) (*proto.SAddResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SAdd(req.Key, req.Member)
if err != nil {
return nil, err
@ -895,10 +895,10 @@ func (s *singleService) SAdd(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -910,7 +910,7 @@ func (s *singleService) SCard(
ctx context.Context,
req *proto.SCardRequest,
) (*proto.SCardResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SCard(req.Key)
if err != nil {
return nil, err
@ -923,10 +923,10 @@ func (s *singleService) SCard(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -938,7 +938,7 @@ func (s *singleService) SDiff(
ctx context.Context,
req *proto.SDiffRequest,
) (*proto.SDiffResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SDiff(req.Key, req.SKeys)
if err != nil {
return nil, err
@ -951,10 +951,10 @@ func (s *singleService) SDiff(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -966,7 +966,7 @@ func (s *singleService) SDiffStore(
ctx context.Context,
req *proto.SDiffStoreRequest,
) (*proto.SDiffStoreResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SDiffStore(req.Key, req.SKeys, req.SaveKey)
if err != nil {
return nil, err
@ -979,10 +979,10 @@ func (s *singleService) SDiffStore(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -994,7 +994,7 @@ func (s *singleService) SInter(
ctx context.Context,
req *proto.SInterRequest,
) (*proto.SInterResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SInter(req.Key, req.SKeys)
if err != nil {
return nil, err
@ -1007,10 +1007,10 @@ func (s *singleService) SInter(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1022,7 +1022,7 @@ func (s *singleService) SInterStore(
ctx context.Context,
req *proto.SInterStoreRequest,
) (*proto.SInterStoreResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SInterStore(req.Key, req.SKeys, req.SaveKey)
if err != nil {
return nil, err
@ -1035,10 +1035,10 @@ func (s *singleService) SInterStore(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1050,7 +1050,7 @@ func (s *singleService) SIsMember(
ctx context.Context,
req *proto.SIsMemberRequest,
) (*proto.SIsMemberResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SIsMember(req.Key, req.Member)
if err != nil {
return nil, err
@ -1063,10 +1063,10 @@ func (s *singleService) SIsMember(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1078,7 +1078,7 @@ func (s *singleService) SMove(
ctx context.Context,
req *proto.SMoveRequest,
) (*proto.SMoveResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SMove(req.Key, req.MoveKey, req.Members)
if err != nil {
return nil, err
@ -1091,10 +1091,10 @@ func (s *singleService) SMove(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1106,7 +1106,7 @@ func (s *singleService) SPop(
ctx context.Context,
req *proto.SPopRequest,
) (*proto.SPopResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SPop(req.Key, req.Count)
if err != nil {
return nil, err
@ -1119,10 +1119,10 @@ func (s *singleService) SPop(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1134,7 +1134,7 @@ func (s *singleService) SRem(
ctx context.Context,
req *proto.SRemRequest,
) (*proto.SRemResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SRem(req.Key, req.Count)
if err != nil {
return nil, err
@ -1147,10 +1147,10 @@ func (s *singleService) SRem(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1162,7 +1162,7 @@ func (s *singleService) SUnion(
ctx context.Context,
req *proto.SUnionRequest,
) (*proto.SUnionResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SUnion(req.Key, req.SKeys)
if err != nil {
return nil, err
@ -1175,10 +1175,10 @@ func (s *singleService) SUnion(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1190,7 +1190,7 @@ func (s *singleService) SUnionStore(
ctx context.Context,
req *proto.SUnionStoreRequest,
) (*proto.SUnionStoreResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SUnionStore(req.Key, req.SKeys, req.SaveKey)
if err != nil {
return nil, err
@ -1203,10 +1203,10 @@ func (s *singleService) SUnionStore(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}
@ -1218,7 +1218,7 @@ func (s *singleService) SScan(
ctx context.Context,
req *proto.SScanRequest,
) (*proto.SScanResponse, error) {
work := event.EventWorkFunc(func() (interface{}, error) {
work := event2.EventWorkFunc(func() (interface{}, error) {
resp, err := s.dao.SScan(req.Key, req.Sursor, req.Regexp, req.Count)
if err != nil {
return nil, err
@ -1231,10 +1231,10 @@ func (s *singleService) SScan(
lruEvent := s.lruProduce.NewEvent(lru.OptionEventName)
lruEvent.InitWaitEvent()
lruEvent.SetValue(lru.WorkFuncEventKey, work)
lruEvent.SetValue(event2.WorkFuncEventKey, work)
s.lruProduce.Call(ctx, lruEvent)
resp, err := lruEvent.StartWaitEvent(s.timeOut)
s.lruProduce.Recovery(lruEvent)
lruEvent.Recovery()
if err != nil {
return nil, err
}