mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 07:12:26 -05:00 
			
		
		
		
	
		
			
	
	
		
			26 lines
		
	
	
	
		
			468 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			26 lines
		
	
	
	
		
			468 B
		
	
	
	
		
			Go
		
	
	
	
	
	
|  | package internal | ||
|  | 
 | ||
|  | import ( | ||
|  | 	"os" | ||
|  | 
 | ||
|  | 	"github.com/tetratelabs/wazero" | ||
|  | ) | ||
|  | 
 | ||
|  | func init() { | ||
|  | 	var err error | ||
|  | 
 | ||
|  | 	if dir := os.Getenv("WAZERO_COMPILATION_CACHE"); dir != "" { | ||
|  | 		// Use on-filesystem compilation cache given by env. | ||
|  | 		Cache, err = wazero.NewCompilationCacheWithDir(dir) | ||
|  | 		if err != nil { | ||
|  | 			panic(err) | ||
|  | 		} | ||
|  | 	} else { | ||
|  | 		// Use in-memory compilation cache. | ||
|  | 		Cache = wazero.NewCompilationCache() | ||
|  | 	} | ||
|  | } | ||
|  | 
 | ||
|  | // Shared WASM compilation cache. | ||
|  | var Cache wazero.CompilationCache |