单例控制器增加SetRedis方法,TODO++

This commit is contained in:
John
2018-04-20 19:20:07 +08:00
parent 10ad8468b7
commit 275a7a948b
2 changed files with 11 additions and 0 deletions

1
TODO
View File

@ -1,6 +1,7 @@
ON THE WAY:
1. 增加对于数据表Model的封装
2. ghttp.Server平滑重启方案
3. 更多数据库的ORM支持
DONE:

View File

@ -61,6 +61,16 @@ func SetDatabase(v *gdb.Db, name...string) {
instances.Set(dbCacheKey, v)
}
// 自定义框架核心组件Redis
func SetRedis(v *gredis.Redis, name...string) {
dbCacheKey := gFRAME_CORE_COMPONENT_NAME_REDIS
if len(name) > 0 {
dbCacheKey += name[0]
}
instances.Set(dbCacheKey, v)
}
// 核心对象View
func View() *gview.View {
result := Get(gFRAME_CORE_COMPONENT_NAME_VIEW)