package cache import ( "context" "github.com/patrickmn/go-cache" "time" ) type MemCache struct { engine *cache.Cache } func (cache *MemCache) Set(ctx context.Context, key string, value any) { cache.engine.Set(key, value, 0) } func (cache *MemCache) SetEx(ctx context.Context, key string, value any, expire time.Duration) { cache.engine.Set(key, value, expire) } func (cache *MemCache) Get(ctx context.Context, key string) (value any, ok bool) { return cache.engine.Get(key) } func (cache *MemCache) Del(ctx context.Context, key string) { cache.engine.Delete(key) } func NewMemCache() *MemCache { return &MemCache{ engine: cache.New(time.Hour, time.Minute*10), } }