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"
}