func FlushCache() { // Flush cache projects. num := len(cachePros) models.FlushCacheProjects(cachePros) beego.Trace("FlushCacheProjects #", num) cachePros = make([]hv.PkgInfo, 0, num) }
func FlushCache() { // Flush cache projects. num := len(cachePros) // Set views increament. for _, pinfo := range cachePros { pinfo.Views += int64(len(cacheVisitIps[pinfo.Id])) } models.FlushCacheProjects(cachePros) beego.Info("FlushCacheProjects #", num) cachePros = make([]hv.PkgInfo, 0, num) cacheVisitIps = make(map[int64]map[string]bool) }
func flushCache() { // Flush cache projects. num := len(cachePros) rtwPros := make([]*models.PkgRock, 0, num) for _, p := range cachePros { rtwPros = append(rtwPros, &models.PkgRock{ Pid: p.Id, Path: p.Path, Rank: p.Rank, }) } models.FlushCacheProjects(cachePros, rtwPros) cachePros = make([]*models.PkgInfo, 0, num) }