mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-05-06 22:12:23 +08:00
29 lines
530 B
Go
29 lines
530 B
Go
package cache
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/uozi-tech/cosy/logger"
|
|
)
|
|
|
|
const (
|
|
NodeCacheKey = "enabled_nodes"
|
|
NodeCacheTTL = 10 * time.Minute
|
|
)
|
|
|
|
// InvalidateNodeCache removes the node cache entry
|
|
func InvalidateNodeCache() {
|
|
Del(NodeCacheKey)
|
|
logger.Debug("Invalidated node cache")
|
|
}
|
|
|
|
// GetCachedNodes retrieves nodes from cache
|
|
func GetCachedNodes() (interface{}, bool) {
|
|
return Get(NodeCacheKey)
|
|
}
|
|
|
|
// SetCachedNodes stores nodes in cache
|
|
func SetCachedNodes(data interface{}) {
|
|
Set(NodeCacheKey, data, NodeCacheTTL)
|
|
}
|