mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Ensure memcache TTL cannot be over 30 days (#14592)
Memcached TTL cannot be > 30 days and if it is attempted the TTL is interpreted as a unix timestamp. This PR ensures that the TTL is switched to a unix timestamp in those cases. Fix #14571 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
		@@ -13,14 +13,14 @@ import (
 | 
			
		||||
// LastCommitCache represents a cache to store last commit
 | 
			
		||||
type LastCommitCache struct {
 | 
			
		||||
	repoPath    string
 | 
			
		||||
	ttl         int64
 | 
			
		||||
	ttl         func() int64
 | 
			
		||||
	repo        *Repository
 | 
			
		||||
	commitCache map[string]*Commit
 | 
			
		||||
	cache       Cache
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewLastCommitCache creates a new last commit cache for repo
 | 
			
		||||
func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl int64, cache Cache) *LastCommitCache {
 | 
			
		||||
func NewLastCommitCache(repoPath string, gitRepo *Repository, ttl func() int64, cache Cache) *LastCommitCache {
 | 
			
		||||
	if cache == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user