chat gpt said this would work and i trust it like 2 %

This commit is contained in:
pigwin
2025-01-09 19:54:11 +00:00
parent d996411adf
commit afd6b12acf
2 changed files with 3 additions and 1 deletions

View File

@@ -3,12 +3,13 @@ package valki
import (
"context"
"fmt"
"time"
"github.com/valkey-io/valkey-go"
)
func SetValkeyValue(ctx context.Context, client valkey.Client, key, value string) error {
err := client.Do(ctx, client.B().Set().Key(key).Value(value).Build()).Error()
err := client.Do(ctx, client.B().Set().Key(key).Value(value).Ex(time.Hour).Build()).Error()
if err != nil {
return fmt.Errorf("failed to set value in Valkey: %v", err)
}