From b751156b5cff69cb88671aba21f52f76ff03aea7 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 21 Feb 2022 21:19:06 +0800 Subject: [PATCH] redis ttl --- pkg/common/db/redisModel.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/common/db/redisModel.go b/pkg/common/db/redisModel.go index 9245e7b1f..c8529b97c 100644 --- a/pkg/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -41,7 +41,7 @@ func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) { } func (d *DataBases) SetAccountCode(account string, code, ttl int) (err error) { key := AccountTempCode + account - _, err = d.Exec("SET", key, code) + _, err = d.Exec("SET", key, code, "ex", ttl) return err } func (d *DataBases) GetAccountCode(account string) (string, error) { @@ -49,7 +49,6 @@ func (d *DataBases) GetAccountCode(account string) (string, error) { return redis.String(d.Exec("GET", key)) } - //Perform seq auto-increment operation of user messages func (d *DataBases) IncrUserSeq(uid string) (uint64, error) { key := userIncrSeq + uid