photoprism/internal/service/thumb-cache.go

21 lines
295 B
Go
Raw Normal View History

package service
import (
"sync"
"time"
gc "github.com/patrickmn/go-cache"
)
var onceThumbCache sync.Once
func initThumbCache() {
services.ThumbCache = gc.New(time.Hour*24, 10*time.Minute)
}
func ThumbCache() *gc.Cache {
onceThumbCache.Do(initThumbCache)
return services.ThumbCache
}