photoprism/internal/service/cache.go
Michael Mayer 75fd1904f3 Add caching to folders API #260
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-22 20:00:33 +02:00

20 lines
261 B
Go

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
}