mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 06:38:37 -04:00 
			
		
		
		
	Update Vendor (#16325)
* Add Dependencie Update Script * update gitea.com/lunny/levelqueue * update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-redis/redis/v8 * update github.com/hashicorp/golang-lru * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/olivere/elastic/v7 * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark
This commit is contained in:
		
							
								
								
									
										2
									
								
								vendor/github.com/hashicorp/golang-lru/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/hashicorp/golang-lru/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1 +1,3 @@ | ||||
| module github.com/hashicorp/golang-lru | ||||
|  | ||||
| go 1.12 | ||||
|   | ||||
							
								
								
									
										50
									
								
								vendor/github.com/hashicorp/golang-lru/lru.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										50
									
								
								vendor/github.com/hashicorp/golang-lru/lru.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -37,7 +37,7 @@ func (c *Cache) Purge() { | ||||
| 	c.lock.Unlock() | ||||
| } | ||||
|  | ||||
| // Add adds a value to the cache.  Returns true if an eviction occurred. | ||||
| // Add adds a value to the cache. Returns true if an eviction occurred. | ||||
| func (c *Cache) Add(key, value interface{}) (evicted bool) { | ||||
| 	c.lock.Lock() | ||||
| 	evicted = c.lru.Add(key, value) | ||||
| @@ -71,8 +71,8 @@ func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) { | ||||
| 	return value, ok | ||||
| } | ||||
|  | ||||
| // ContainsOrAdd checks if a key is in the cache  without updating the | ||||
| // recent-ness or deleting it for being stale,  and if not, adds the value. | ||||
| // ContainsOrAdd checks if a key is in the cache without updating the | ||||
| // recent-ness or deleting it for being stale, and if not, adds the value. | ||||
| // Returns whether found and whether an eviction occurred. | ||||
| func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) { | ||||
| 	c.lock.Lock() | ||||
| @@ -85,18 +85,52 @@ func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) { | ||||
| 	return false, evicted | ||||
| } | ||||
|  | ||||
| // Remove removes the provided key from the cache. | ||||
| func (c *Cache) Remove(key interface{}) { | ||||
| // PeekOrAdd checks if a key is in the cache without updating the | ||||
| // recent-ness or deleting it for being stale, and if not, adds the value. | ||||
| // Returns whether found and whether an eviction occurred. | ||||
| func (c *Cache) PeekOrAdd(key, value interface{}) (previous interface{}, ok, evicted bool) { | ||||
| 	c.lock.Lock() | ||||
| 	c.lru.Remove(key) | ||||
| 	defer c.lock.Unlock() | ||||
|  | ||||
| 	previous, ok = c.lru.Peek(key) | ||||
| 	if ok { | ||||
| 		return previous, true, false | ||||
| 	} | ||||
|  | ||||
| 	evicted = c.lru.Add(key, value) | ||||
| 	return nil, false, evicted | ||||
| } | ||||
|  | ||||
| // Remove removes the provided key from the cache. | ||||
| func (c *Cache) Remove(key interface{}) (present bool) { | ||||
| 	c.lock.Lock() | ||||
| 	present = c.lru.Remove(key) | ||||
| 	c.lock.Unlock() | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // Resize changes the cache size. | ||||
| func (c *Cache) Resize(size int) (evicted int) { | ||||
| 	c.lock.Lock() | ||||
| 	evicted = c.lru.Resize(size) | ||||
| 	c.lock.Unlock() | ||||
| 	return evicted | ||||
| } | ||||
|  | ||||
| // RemoveOldest removes the oldest item from the cache. | ||||
| func (c *Cache) RemoveOldest() { | ||||
| func (c *Cache) RemoveOldest() (key interface{}, value interface{}, ok bool) { | ||||
| 	c.lock.Lock() | ||||
| 	c.lru.RemoveOldest() | ||||
| 	key, value, ok = c.lru.RemoveOldest() | ||||
| 	c.lock.Unlock() | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // GetOldest returns the oldest entry | ||||
| func (c *Cache) GetOldest() (key interface{}, value interface{}, ok bool) { | ||||
| 	c.lock.Lock() | ||||
| 	key, value, ok = c.lru.GetOldest() | ||||
| 	c.lock.Unlock() | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // Keys returns a slice of the keys in the cache, from oldest to newest. | ||||
|   | ||||
							
								
								
									
										16
									
								
								vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -73,6 +73,9 @@ func (c *LRU) Add(key, value interface{}) (evicted bool) { | ||||
| func (c *LRU) Get(key interface{}) (value interface{}, ok bool) { | ||||
| 	if ent, ok := c.items[key]; ok { | ||||
| 		c.evictList.MoveToFront(ent) | ||||
| 		if ent.Value.(*entry) == nil { | ||||
| 			return nil, false | ||||
| 		} | ||||
| 		return ent.Value.(*entry).value, true | ||||
| 	} | ||||
| 	return | ||||
| @@ -142,6 +145,19 @@ func (c *LRU) Len() int { | ||||
| 	return c.evictList.Len() | ||||
| } | ||||
|  | ||||
| // Resize changes the cache size. | ||||
| func (c *LRU) Resize(size int) (evicted int) { | ||||
| 	diff := c.Len() - size | ||||
| 	if diff < 0 { | ||||
| 		diff = 0 | ||||
| 	} | ||||
| 	for i := 0; i < diff; i++ { | ||||
| 		c.removeOldest() | ||||
| 	} | ||||
| 	c.size = size | ||||
| 	return diff | ||||
| } | ||||
|  | ||||
| // removeOldest removes the oldest item from the cache. | ||||
| func (c *LRU) removeOldest() { | ||||
| 	ent := c.evictList.Back() | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -10,7 +10,7 @@ type LRUCache interface { | ||||
| 	// updates the "recently used"-ness of the key. #value, isFound | ||||
| 	Get(key interface{}) (value interface{}, ok bool) | ||||
|  | ||||
| 	// Check if a key exsists in cache without updating the recent-ness. | ||||
| 	// Checks if a key exists in cache without updating the recent-ness. | ||||
| 	Contains(key interface{}) (ok bool) | ||||
|  | ||||
| 	// Returns key's value without updating the "recently used"-ness of the key. | ||||
| @@ -31,6 +31,9 @@ type LRUCache interface { | ||||
| 	// Returns the number of items in the cache. | ||||
| 	Len() int | ||||
|  | ||||
| 	// Clear all cache entries | ||||
| 	// Clears all cache entries. | ||||
| 	Purge() | ||||
|  | ||||
|   // Resizes cache, returning number evicted | ||||
|   Resize(int) int | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user