Commit 290f5ff7 authored by chenweijian's avatar chenweijian

group support

parent d4050765
...@@ -126,13 +126,13 @@ func DecrNum(key string, num int64) (int64, error) { ...@@ -126,13 +126,13 @@ func DecrNum(key string, num int64) (int64, error) {
return resNum, nil return resNum, nil
} }
func SetExpire(key string, expiration time.Duration) error { func SetExpire(cli *redis.Client, key string, expiration time.Duration) error {
ttl, err := RedisClient.TTL(context.Background(), key).Result() ttl, err := cli.TTL(context.Background(), key).Result()
if err != nil { if err != nil {
return err return err
} }
if ttl == -1 { if ttl == -1 {
err = RedisClient.Expire(context.Background(), key, expiration).Err() err = cli.Expire(context.Background(), key, expiration).Err()
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment