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