fix: fix redis error

This commit is contained in:
CaIon
2024-01-26 15:52:23 +08:00
parent 3dc5d4d95a
commit 70bdb8ca90
2 changed files with 8 additions and 1 deletions

View File

@@ -57,6 +57,11 @@ func RedisGet(key string) (string, error) {
return RDB.Get(ctx, key).Result()
}
func RedisExpire(key string, expiration time.Duration) error {
ctx := context.Background()
return RDB.Expire(ctx, key, expiration).Err()
}
func RedisGetEx(key string, expiration time.Duration) (string, error) {
ctx := context.Background()
return RDB.GetSet(ctx, key, expiration).Result()