pkg/dal/local_cache.go

27 lines
537 B
Go

// Package dal provides data access layer implementations including local caching and Redis operations.
package dal
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()