2021-01-08 12:52:26 +01:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
gc "github.com/patrickmn/go-cache"
|
|
|
|
)
|
|
|
|
|
|
|
|
var onceThumbCache sync.Once
|
|
|
|
|
|
|
|
func initThumbCache() {
|
2021-01-08 13:29:01 +01:00
|
|
|
services.ThumbCache = gc.New(time.Hour*24, 10*time.Minute)
|
2021-01-08 12:52:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func ThumbCache() *gc.Cache {
|
|
|
|
onceThumbCache.Do(initThumbCache)
|
|
|
|
|
|
|
|
return services.ThumbCache
|
|
|
|
}
|