// Code generated by gen-struct. DO NOT EDIT. // make gen-service generated package service import ( context "context" "gitee.com/wheat-os/wheatCache/pkg/event" "gitee.com/wheat-os/wheatCache/pkg/lru" "gitee.com/wheat-os/wheatCache/pkg/proto" ) {% for key in keys %} func (s *singleService) {{key.method}}( ctx context.Context, req *proto.{{key.method}}Request, ) (*proto.{{key.method}}Response, error) { work := event.EventWorkFunc(func() (interface{}, error) { resp, err := s.dao.{{key.method}}({% for opt in key.option %}req.{{opt[0]}}, {% endfor %}) if err != nil{ return nil, err } if s.aof != nil { s.aof.SendRequest("{{key.method}}", req) } return resp, nil }) lruEvent := s.lruProduce.NewEvent(lru.OptionEventName) lruEvent.InitWaitEvent() lruEvent.SetValue(lru.WorkFuncEventKey, work) s.lruProduce.Call(ctx, lruEvent) resp, err := lruEvent.StartWaitEvent(s.timeOut) s.lruProduce.Recovery(lruEvent) if err != nil { return nil, err } return resp.(*proto.{{key.method}}Response), nil } {% endfor %}