pkg/storage/local_cache.go

26 lines
437 B
Go
Raw Normal View History

2023-04-09 17:44:31 +00:00
package storage
import (
"time"
"github.com/patrickmn/go-cache"
)
// SlotCache :
type SlotCache struct {
Slot *cache.Cache
DefaultExpiration time.Duration
}
// NewSlotCache :
func NewSlotCache() (*SlotCache, error) {
c := SlotCache{
Slot: cache.New(5*time.Minute, 10*time.Minute),
DefaultExpiration: cache.DefaultExpiration,
}
return &c, nil
}
// LocalCache :
var LocalCache, _ = NewSlotCache()