mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Add commit count caching (#2774)
* Add commit count caching * Small refactoring * Add different key prefix for refs and commits * Add configuratuion option to allow to change caching time or disable it
This commit is contained in:
		@@ -99,9 +99,9 @@ func NewMacaron() *macaron.Macaron {
 | 
			
		||||
		Redirect:    true,
 | 
			
		||||
	}))
 | 
			
		||||
	m.Use(cache.Cacher(cache.Options{
 | 
			
		||||
		Adapter:       setting.CacheAdapter,
 | 
			
		||||
		AdapterConfig: setting.CacheConn,
 | 
			
		||||
		Interval:      setting.CacheInterval,
 | 
			
		||||
		Adapter:       setting.CacheService.Adapter,
 | 
			
		||||
		AdapterConfig: setting.CacheService.Conn,
 | 
			
		||||
		Interval:      setting.CacheService.Interval,
 | 
			
		||||
	}))
 | 
			
		||||
	m.Use(captcha.Captchaer(captcha.Options{
 | 
			
		||||
		SubURL: setting.AppSubURL,
 | 
			
		||||
@@ -576,9 +576,9 @@ func RegisterRoutes(m *macaron.Macaron) {
 | 
			
		||||
				ctx.Handle(500, "GetBranchCommit", err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount()
 | 
			
		||||
			ctx.Repo.CommitsCount, err = ctx.Repo.GetCommitsCount()
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				ctx.Handle(500, "CommitsCount", err)
 | 
			
		||||
				ctx.Handle(500, "GetCommitsCount", err)
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user