Files
PandaX/pkg/cache/product_rule.go
2023-10-17 14:39:01 +08:00

21 lines
422 B
Go

package cache
import (
"github.com/PandaXGO/PandaKit/cache"
"time"
)
var ProductCache = cache.NewTimedCache(cache.NoExpiration, 24*time.Hour)
func ComputeIfAbsentProductRule(key string, fun func(any) (any, error)) (any, error) {
return ProductCache.ComputeIfAbsent(key, fun)
}
func DelProductRule(key string) {
ProductCache.Delete(key)
}
func PutProductRule(key string, data any) {
ProductCache.Put(key, data)
}