diff options
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 1b1be62f87..eca71568ee 100644 --- a/models/repo.go +++ b/models/repo.go @@ -258,6 +258,17 @@ func (repo *Repository) APIFormat(mode AccessMode) *api.Repository { return repo.innerAPIFormat(mode, false) } +// GetCommitsCountCacheKey returns cache key used for commits count caching. +func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string { + var prefix string + if isRef { + prefix = "ref" + } else { + prefix = "commit" + } + return fmt.Sprintf("commits-count-%d-%s-%s", repo.ID, prefix, contextName) +} + func (repo *Repository) innerAPIFormat(mode AccessMode, isParent bool) *api.Repository { var parent *api.Repository |