26 lines
437 B
Go
26 lines
437 B
Go
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()
|