Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Bring back pipelining feature to Golang client #174

Merged
merged 11 commits into from
Jul 25, 2022

Conversation

buraksezer
Copy link
Owner

@buraksezer buraksezer commented Jul 22, 2022

This PR implements Redis Pipelining in the Golang Client, both ClusterClient and EmbeddedClient. See #173

Here is a sample:

func ExamplePipeline() {
	c, err := NewClusterClient([]string{"127.0.0.1:3320"})
	if err != nil {
		// Handle this error
	}
	dm, err := c.NewDMap("mydmap")
	if err != nil {
		// Handle this error
	}

	ctx := context.Background()

	pipe, err := dm.Pipeline()
	if err != nil {
		// Handle this error
	}

	futurePut, err := pipe.Put(ctx, "key-1", "value-1")
	if err != nil {
		// Handle this error
	}

	futureGet := pipe.Get(ctx, "key-1")

	err = pipe.Exec(context.Background())
	if err != nil {
		// Handle this error
	}

	err = futurePut.Result()
	if err != nil {
		// Handle this error
	}

	gr, err := futureGet.Result()
	if err != nil {
		// Handle this error
	}
	value, err := gr.String()
	if err != nil {
		// Handle this error
	}
	fmt.Println(value)
}

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 11 Code Smells

No Coverage information No Coverage information
10.7% 10.7% Duplication

@buraksezer buraksezer merged commit 37aa6d3 into master Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant