mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 09:22:25 -05:00 
			
		
		
		
	Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
This commit is contained in:
		
					parent
					
						
							
								329a5e8144
							
						
					
				
			
			
				commit
				
					
						98263a7de6
					
				
			
		
					 2677 changed files with 1090869 additions and 219 deletions
				
			
		
							
								
								
									
										40
									
								
								vendor/github.com/quasoft/memstore/cache.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								vendor/github.com/quasoft/memstore/cache.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| package memstore | ||||
| 
 | ||||
| import ( | ||||
| 	"sync" | ||||
| ) | ||||
| 
 | ||||
| type cache struct { | ||||
| 	data  map[string]valueType | ||||
| 	mutex sync.RWMutex | ||||
| } | ||||
| 
 | ||||
| func newCache() *cache { | ||||
| 	return &cache{ | ||||
| 		data: make(map[string]valueType), | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (c *cache) value(name string) (valueType, bool) { | ||||
| 	c.mutex.RLock() | ||||
| 	defer c.mutex.RUnlock() | ||||
| 
 | ||||
| 	v, ok := c.data[name] | ||||
| 	return v, ok | ||||
| } | ||||
| 
 | ||||
| func (c *cache) setValue(name string, value valueType) { | ||||
| 	c.mutex.Lock() | ||||
| 	defer c.mutex.Unlock() | ||||
| 
 | ||||
| 	c.data[name] = value | ||||
| } | ||||
| 
 | ||||
| func (c *cache) delete(name string) { | ||||
| 	c.mutex.Lock() | ||||
| 	defer c.mutex.Unlock() | ||||
| 
 | ||||
| 	if _, ok := c.data[name]; ok { | ||||
| 		delete(c.data, name) | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue