Files
alfred-be/alfred/pkg/cache/config.go
2026-03-08 16:14:42 +05:30

30 lines
477 B
Go

package cache
import (
"alfred/utils"
"time"
"github.com/patrickmn/go-cache"
)
type ConfigClientInterface interface {
PutWithTtl(key string, value interface{}, time time.Duration)
PutWithDefaultTtl(key string, value interface{})
Get(key string) (interface{}, bool)
Delete(key string)
}
type Client struct {
cacheClient *cache.Cache
}
func NewCacheConfig() *Client {
return &Client{
cacheClient: cache.New(
5*time.Minute,
utils.DefaultCacheTtl,
),
}
}