dd442ab9e9
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
26 lines
342 B
Go
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
|
|
}
|