wheat-cache/pkg/lru/worker.go

31 lines
501 B
Go
Raw Normal View History

2021-09-27 11:29:47 +08:00
package lru
import (
"context"
"gitee.com/timedb/wheatCache/pkg/event"
"log"
)
func lruCleanWork() {
}
func (lru *singleCache) lruSingleWork() interface{} {
ctx := context.Background()
for {
2021-10-04 16:25:52 +08:00
workEvent := lru.lruConsumer.Receive(ctx)
2021-09-27 11:29:47 +08:00
2021-10-04 16:25:52 +08:00
workFunc, ok := workEvent.GetValue(WorkFuncEventKey)
2021-09-27 11:29:47 +08:00
if !ok {
continue
}
2021-10-04 16:25:52 +08:00
switch workFunc.(type) {
2021-10-03 09:47:04 +08:00
case event.EventWorkFunc:
2021-10-04 16:25:52 +08:00
workEvent.ExecWorkAndSendResult(workFunc.(event.EventWorkFunc))
2021-10-03 09:47:04 +08:00
default:
log.Print("this is debug ")
2021-09-27 11:29:47 +08:00
}
}
}