package fcredis import ( "fmt" "sync/atomic" ) var ( keys = uint32(24) ops = uint32(0) ) func GetRandKeys(sourceKey string) []string { if gMode == ModeSingle { return []string{sourceKey} } desKeys := make([]string, 0, keys) for i := uint32(0); i < keys; i++ { desKeys = append(desKeys, fmt.Sprintf("%s_%d", sourceKey, i)) } return desKeys } func GetRandKey(sourceKey string) string { if gMode == ModeSingle { return sourceKey } index := atomic.AddUint32(&ops, 1) return fmt.Sprintf("%s_%d", sourceKey, index%keys) }