photoprism/internal/service/cache.go
Michael Mayer dd442ab9e9 Add moments #154
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-30 01:41:47 +02:00

26 lines
342 B
Go

package service
import (
"sync"
"time"
"github.com/allegro/bigcache"
)
var onceCache sync.Once
func initCache() {
var err error
services.Cache, err = bigcache.NewBigCache(bigcache.DefaultConfig(time.Hour))
if err != nil {
log.Errorf("")
}
}
func Cache() *bigcache.BigCache {
onceCache.Do(initCache)
return services.Cache
}