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

Function cmdSlot

osscluster.go:2377–2387  ·  view source on GitHub ↗
(cmd Cmder, pos int, prefferedRandomSlot int)

Source from the content-addressed store, hash-verified

2375}
2376
2377func cmdSlot(cmd Cmder, pos int, prefferedRandomSlot int) int {
2378 if pos == 0 {
2379 if prefferedRandomSlot != -1 {
2380 return prefferedRandomSlot
2381 }
2382 // Return -1 for keyless commands to signal that ShardPicker should be used
2383 return -1
2384 }
2385 firstKey := cmd.stringArg(pos)
2386 return hashtag.Slot(firstKey)
2387}
2388
2389func (c *ClusterClient) cmdNode(
2390 ctx context.Context,

Callers 1

cmdSlotWithPosMethod · 0.85

Calls 2

SlotFunction · 0.92
stringArgMethod · 0.65

Tested by

no test coverage detected