photoprism/internal/get/thumb-cache.go

21 lines
291 B
Go
Raw Normal View History

package get
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
}