sqlc: fixed CacheIndexService initial logic

r/paopao-ce-pro
Michael Li 3 years ago
parent efc0eaf9af
commit d81b05b46d
No known key found for this signature in database

@ -68,16 +68,23 @@ func NewDataService() (core.DataService, core.VersionInfo) {
} }
// initialize core.CacheIndexService // initialize core.CacheIndexService
if cfg.If("SimpleCacheIndex") { cfg.On(cfg.Actions{
// simpleCache use special post index service "SimpleCacheIndex": func() {
ips = newSimpleIndexPostsService(db, ths) // simpleCache use special post index service
cis, v = cache.NewSimpleCacheIndexService(ips) ips = newSimpleIndexPostsService(db, ths)
} else if cfg.If("BigCacheIndex") { cis, v = cache.NewSimpleCacheIndexService(ips)
// TODO: make cache index post in different scence like friendship/followship/lightship },
cis, v = cache.NewBigCacheIndexService(ips, ams) "BigCacheIndex": func() {
} else { // TODO: make cache index post in different scence like friendship/followship/lightship
cis, v = cache.NewBigCacheIndexService(ips, ams)
},
"RedisCacheIndex": func() {
cis, v = cache.NewRedisCacheIndexService(ips, ams)
},
}, func() {
// defualt no cache
cis, v = cache.NewNoneCacheIndexService(ips) cis, v = cache.NewNoneCacheIndexService(ips)
} })
logrus.Infof("use %s as cache index service by version: %s", v.Name(), v.Version()) logrus.Infof("use %s as cache index service by version: %s", v.Name(), v.Version())
ds := &dataSrv{ ds := &dataSrv{

Loading…
Cancel
Save