photoprism/internal/service/cache.go

21 lines
261 B
Go
Raw Normal View History

package service
import (
"sync"
"time"
gc "github.com/patrickmn/go-cache"
)
var onceCache sync.Once
func initCache() {
services.Cache = gc.New(336*time.Hour, 30*time.Minute)
}
func Cache() *gc.Cache {
onceCache.Do(initCache)
return services.Cache
}