forked from lug/matterbridge
		
	Update dependencies / vendor (#1146)
This commit is contained in:
		
							
								
								
									
										22
									
								
								vendor/github.com/hashicorp/golang-lru/lru.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								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,6 +85,22 @@ func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) {
 | 
			
		||||
	return false, evicted
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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()
 | 
			
		||||
	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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user