Example #1
0
func FlushCache() {
	// Flush cache projects.
	num := len(cachePros)
	models.FlushCacheProjects(cachePros)
	beego.Trace("FlushCacheProjects #", num)

	cachePros = make([]hv.PkgInfo, 0, num)
}
Example #2
0
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)
}
Example #3
0
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)
}