MCPcopy
hub / github.com/redis/go-redis / ScriptLoad

Method ScriptLoad

osscluster_commands.go:31–55  ·  view source on GitHub ↗
(ctx context.Context, script string)

Source from the content-addressed store, hash-verified

29}
30
31func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCmd {
32 cmd := NewStringCmd(ctx, "script", "load", script)
33 _ = c.withProcessHook(ctx, cmd, func(ctx context.Context, _ Cmder) error {
34 var mu sync.Mutex
35 err := c.ForEachShard(ctx, func(ctx context.Context, shard *Client) error {
36 val, err := shard.ScriptLoad(ctx, script).Result()
37 if err != nil {
38 return err
39 }
40
41 mu.Lock()
42 if cmd.Val() == "" {
43 cmd.val = val
44 }
45 mu.Unlock()
46
47 return nil
48 })
49 if err != nil {
50 cmd.SetErr(err)
51 }
52 return nil
53 })
54 return cmd
55}
56
57func (c *ClusterClient) ScriptFlush(ctx context.Context) *StatusCmd {
58 cmd := NewStatusCmd(ctx, "script", "flush")

Callers

nothing calls this directly

Calls 7

ForEachShardMethod · 0.95
ValMethod · 0.95
NewStringCmdFunction · 0.85
withProcessHookMethod · 0.80
ResultMethod · 0.65
ScriptLoadMethod · 0.65
SetErrMethod · 0.65

Tested by

no test coverage detected