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