From 275a7a948b7f3a3265de2bc2bf2f3ec0d98d1063 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 20 Apr 2018 19:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BE=8B=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0SetRedis=E6=96=B9=E6=B3=95=EF=BC=8CTODO++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO | 1 + g/frame/gins/gins.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/TODO b/TODO index 053b2292f..a3eafd465 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,7 @@ ON THE WAY: 1. 增加对于数据表Model的封装; 2. ghttp.Server平滑重启方案; +3. 更多数据库的ORM支持; DONE: diff --git a/g/frame/gins/gins.go b/g/frame/gins/gins.go index e07f79a1e..688c8a1ab 100644 --- a/g/frame/gins/gins.go +++ b/g/frame/gins/gins.go @@ -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)