Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.02 KB

PipelineExample.md

File metadata and controls

62 lines (43 loc) · 1.02 KB

Pipeline

An example of pipelines Redis Stack Redis commands (JSON.SET & JSON.CLEAR & JSON.GET)

Connect to the Redis server and Setup new Pipeline

IDatabase db = redisFixture.Redis.GetDatabase();
var pipeline = new Pipeline(db);

Add JSON data to pipeline

pipeline.Json.SetAsync("person", "$", new { name = "John", age = 30, city = "New York", nicknames = new[] { "John", "Johny", "Jo" } });

Increase age by 2

pipeline.Json.NumIncrbyAsync("person", "$.age", 2);

Remove the nicknames field from the JSON object

pipeline.Json.ClearAsync("person", "$.nicknames");

Delete the nicknames

pipeline.Json.DelAsync("person", "$.nicknames");

Retrieve the JSON response

var getResponse = pipeline.Json.GetAsync("person");

Execute pipeline

pipeline.Execute();

Access the result of the JSON response

var result = getResponse.Result;

now result is:

{
  "name": "John",
  "age": 32,
  "city": "New York"
}