sqlx: fixed CacheIndexService initial logic

r/paopao-ce-xtra
Michael Li 2 years ago
parent 1226a1a60d
commit 85b0c4ac56
No known key found for this signature in database

@ -73,16 +73,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