14 lines
329 B
Go
14 lines
329 B
Go
|
|
package utils
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/redis/go-redis/v9"
|
||
|
|
)
|
||
|
|
|
||
|
|
func StoreToken(ctx context.Context, rdb *redis.Client, token, username string) error {
|
||
|
|
// return rdb.Set(ctx context.Context, key string, value interface{}, expiration time.Duration)
|
||
|
|
return rdb.Set(ctx, "token"+username, token, time.Hour).Err()
|
||
|
|
}
|