You've already forked nginx-proxy-manager
							
							
				mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 18:05:34 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			574 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			574 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package middleware
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| 
 | |
| 	"npm/internal/logger"
 | |
| 
 | |
| 	cache "github.com/patrickmn/go-cache"
 | |
| )
 | |
| 
 | |
| // AuthCache is a cache item that stores the Admin API data for each admin that has been requesting endpoints
 | |
| var AuthCache *cache.Cache
 | |
| 
 | |
| // AuthCacheInit will create a new Memory Cache
 | |
| func AuthCacheInit() {
 | |
| 	logger.Debug("Creating a new AuthCache")
 | |
| 	AuthCache = cache.New(1*time.Minute, 5*time.Minute)
 | |
| }
 | |
| 
 | |
| // AuthCacheSet will store the item in memory for the expiration time
 | |
| func AuthCacheSet(k string, x interface{}) {
 | |
| 	AuthCache.Set(k, x, cache.DefaultExpiration)
 | |
| }
 |