package cache import ( "container/list" "sync" ) //// AddIndexHandleExcel 添加处理excel变更队列 //func AddIndexHandleExcel(filePath string) bool { // if global.Re == nil { // if global.Rc != nil { // err := global.Rc.LPush(utils.HANDLE_HONGTAO_EXCEL, filePath) // if err != nil { // fmt.Println("Add Index Handle Excel LPush Err:" + err.Error()) // } // return true // } // return true // } // return false //} // HandleExcelList 刷新的列表 var HandleExcelList *list.List func init() { HandleExcelList = list.New() } var HandleExcelFilePathMap = make(map[string]int) // HandleExcelFilePathMutex 创建一个互斥锁 var HandleExcelFilePathMutex sync.Mutex // AddIndexHandleExcel // @Description: 添加处理excel变更队列 // @author: Roc // @datetime2023-10-31 09:40:30 // @param filePath string func AddIndexHandleExcel(filePath string) { HandleExcelFilePathMutex.Lock() defer HandleExcelFilePathMutex.Unlock() // 如果存在该路径,那么就不记录入list if _, ok := HandleExcelFilePathMap[filePath]; ok { return } HandleExcelList.PushBack(filePath) HandleExcelFilePathMap[filePath] = 1 return }