package redisdb import ( "context" "encoding/json" "time" "git.selly.red/Selly-Modules/logger" ) // SetKeyValue ... func SetKeyValue(ctx context.Context, key string, value interface{}) { b, err := json.Marshal(value) if err != nil { logger.Error("", logger.LogData{ Source: "redisdb.SetKeyValue", Message: err.Error(), Data: logger.Map{ "key": key, "value": value, }, }) return } rdb.Set(ctx, key, b, 0) } // SetTTL ... func SetTTL(ctx context.Context, key string, value interface{}, d time.Duration) { b, err := json.Marshal(value) if err != nil { logger.Error("", logger.LogData{ Source: "redisdb.SetTTL", Message: err.Error(), Data: logger.Map{ "key": key, "value": value, "duration": d, }, }) return } rdb.Set(ctx, key, b, d) }