You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
523 B
25 lines
523 B
2 years ago
|
package data
|
||
|
|
||
|
import (
|
||
|
"git.gz.internal.jumaiyx.cn/jm/jmproto/conf"
|
||
|
jredis "git.gz.internal.jumaiyx.cn/job/room-hot-compute/pkg/redis"
|
||
|
"git.gz.internal.jumaiyx.cn/pkg/log"
|
||
|
"github.com/google/wire"
|
||
|
)
|
||
|
|
||
|
var ProviderDataSet = wire.NewSet(NewData)
|
||
|
|
||
|
type Data struct {
|
||
|
Cache *jredis.Cache
|
||
|
}
|
||
|
|
||
|
func NewData(c *conf.Data, log log.Logger) (*Data, func(), error) {
|
||
|
cleanup := func() {
|
||
|
log.Info("closing the data resources")
|
||
|
}
|
||
|
cache := jredis.NewCache(log, c.Redis)
|
||
|
return &Data{
|
||
|
Cache: cache, // redis
|
||
|
}, cleanup, nil
|
||
|
}
|