package lru import ( "context" "gitee.com/timedb/wheatCache/pkg/errorx" "gitee.com/timedb/wheatCache/pkg/event" ) func (lru *SingleCache) lruSingleWork() interface{} { ctx := context.Background() for { workEvent := lru.lruConsumer.Receive(ctx) switch workEvent.GetEventName() { case OptionEventName: workFunc, ok := workEvent.GetValue(WorkFuncEventKey) if !ok { workEvent.ExecWorkAndSendResult(func() (interface{}, error) { return nil, errorx.New("the event haven't work of function") }) continue } if work, ok := workFunc.(event.EventWorkFunc); ok { workEvent.ExecWorkAndSendResult(work) } case CleanEventName: } } }