Fixed leak
This commit is contained in:
parent
f75db108a7
commit
ead52d8740
1 changed files with 4 additions and 0 deletions
|
@ -19,6 +19,8 @@ func SetCache(key string, value string, ttlMinutes int) bool {
|
|||
DB: 0,
|
||||
})
|
||||
|
||||
defer redis.Client.Close(*rdb)
|
||||
|
||||
err := rdb.Set(ctx, key, value, time.Minute*time.Duration(ttlMinutes)).Err()
|
||||
|
||||
return err != nil
|
||||
|
@ -31,6 +33,8 @@ func GetCache(key string) string {
|
|||
DB: 0,
|
||||
})
|
||||
|
||||
defer redis.Client.Close(*rdb)
|
||||
|
||||
val, err := rdb.Get(ctx, key).Result()
|
||||
if err != nil {
|
||||
return "nil"
|
||||
|
|
Loading…
Add table
Reference in a new issue