Skip to content

Commit f04dfb2

Browse files
committed
Refactor Redis configuration handling in KV cache scorer
Replace direct Redis address assignment with URL parsing for better configuration management. This ensures proper error handling and compatibility with Redis connection options. Added Redis client dependency to facilitate this change.
1 parent f6c57c5 commit f04dfb2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/scheduling/plugins/scorer/kvcache-aware.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package scorer
33
import (
44
"context"
55
"fmt"
6+
"github.com/redis/go-redis/v9"
67
"os"
78

89
kvcache "github.com/llm-d/llm-d-kv-cache-manager/pkg/kv-cache"
@@ -37,7 +38,12 @@ func NewKVCacheAwareScorer(ctx context.Context) (plugins.Scorer, error) {
3738

3839
redisAddr := os.Getenv(kvCacheRedisEnvVar)
3940
if redisAddr != "" {
40-
config.KVBlockIndexerConfig.RedisAddr = redisAddr
41+
redisOpt, err := redis.ParseURL(kvCacheRedisEnvVar)
42+
if err != nil {
43+
return nil, fmt.Errorf("failed to parse redisURL: %w", err)
44+
}
45+
46+
config.KVBlockIndexerConfig.RedisOpt = redisOpt
4147
} else {
4248
return nil, fmt.Errorf("environment variable %s is not set", kvCacheRedisEnvVar)
4349
}

0 commit comments

Comments
 (0)