Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager
This commit is contained in:
51
backend/internal/cache/cache.go
vendored
Normal file
51
backend/internal/cache/cache.go
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"npm/internal/entity/setting"
|
||||
"npm/internal/logger"
|
||||
)
|
||||
|
||||
// Cache is a memory cache
|
||||
type Cache struct {
|
||||
Settings *map[string]setting.Model
|
||||
}
|
||||
|
||||
// Status is the status of last update
|
||||
type Status struct {
|
||||
LastUpdate time.Time
|
||||
Valid bool
|
||||
}
|
||||
|
||||
// NewCache will create and return a new Cache object
|
||||
func NewCache() *Cache {
|
||||
return &Cache{
|
||||
Settings: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh will refresh all cache items
|
||||
func (c *Cache) Refresh() {
|
||||
c.RefreshSettings()
|
||||
}
|
||||
|
||||
// Clear will clear the cache
|
||||
func (c *Cache) Clear() {
|
||||
c.Settings = nil
|
||||
}
|
||||
|
||||
// RefreshSettings will refresh the settings from db
|
||||
func (c *Cache) RefreshSettings() {
|
||||
logger.Info("Cache refreshing Settings")
|
||||
/*
|
||||
c.ProductOffers = client.GetProductOffers()
|
||||
|
||||
if c.ProductOffers != nil {
|
||||
c.Status["product_offers"] = Status{
|
||||
LastUpdate: time.Now(),
|
||||
Valid: true,
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user