Respsody.Generators 0.0.8

dotnet add package Respsody.Generators --version 0.0.8
                    
NuGet\Install-Package Respsody.Generators -Version 0.0.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Respsody.Generators" Version="0.0.8">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Respsody.Generators" Version="0.0.8" />
                    
Directory.Packages.props
<PackageReference Include="Respsody.Generators">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Respsody.Generators --version 0.0.8
                    
#r "nuget: Respsody.Generators, 0.0.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Respsody.Generators@0.0.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Respsody.Generators&version=0.0.8
                    
Install as a Cake Addin
#tool nuget:?package=Respsody.Generators&version=0.0.8
                    
Install as a Cake Tool

Respsody

Respsody is an experimental, high-performance, asynchronous, general-purpose RESP3 client library written in C#. It's currently in an early stage of development and intended for experimentation and community feedback.

Quick start

using Respsody;
using Respsody.Resp;
using System.Net;
using System.Text;
using static System.Console;

var clientFactory = new RespClientFactory();
using var client = await clientFactory.Create(new IPEndPoint(IPAddress.Loopback, 6379));

var utf8Key = Key.Utf8("respsody");
Key strKey = "gob_key"; // same as Key.Utf8
var arrKey = Key.ByteArray([1, 0, 1]);
var utf16Key = Key.Unicode("‼️");

await client.Set(utf8Key, Value.Utf8("hello, respsody!"));
await client.Set(arrKey, Value.ByteArray([0, 3, 0, 3, 6, 6]));
await client.Set(strKey, Value.Utf8("we need a gimmick!"));
await client.Set(utf16Key, Value.Unicode("⚡"));

//dispose non-void responses to release underlying buffers
using var getResponse = await client.Get(utf8Key);

WriteLine("- GET result -");
WriteLine(getResponse.ToString());

//for aggregate responses(arrays, maps, sets) dispose only root response
using var mgetResponse = await client.Mget([strKey, utf16Key, arrKey]);

OutputEncoding = Encoding.Unicode;
WriteLine("- MGET result -");
Write("strings: ");
Write(mgetResponse[0].ToRespString());
WriteLine(mgetResponse[1].ToRespString().AsUnicodeSpan());

Write("byte[]: ");
WriteLine($"{string.Join(",", [..mgetResponse[2].ToRespString().GetSpan()])}");

//define and generate commands:
[RespCommand("GET key", ResponseType.String)]
[RespCommand("SET key value", ResponseType.Void)]
[RespCommand("MGET key [key ...]", ResponseType.Array)]
[RespCommand("MSET key value [key value ...]", ResponseType.Void)]
[RespCommand("COMMAND DOCS [command-name:string [command-name:string ...]]", ResponseType.Map)]
public static class Commands;

Cluster usage:

using Respsody.Cluster;

var clusterRouter = new ClusterRouter(
    new ClusterRouterOptions
    {
        SeedEndpoints = ["some_cluster_host1:6379", "some_cluster_host2:6379"],
        ClientOptions = new RespClientOptions()
    });

await clusterRouter.Initialize();

// execute command on primary node that is responsible for key
using var v1 = await clusterRouter.RouteTo(RolePreference.Primary).Get(Key.Utf8("some_key_1"));

// pick random node and execute COMMAND DOCS on it
using var docs = await clusterRouter.PickRandom().Command(COMMAND.DOCS);

//group objects by node and execute commands on it
(Key Key, Value Value)[] objects = [(Key.Utf8("k_1"), Value.Utf8("v_1")), /* ... */ (Key.Utf8("k_n"), Value.Utf8("v_n"))];
foreach (var (node, nodeObjects)in clusterRouter.RouteTo(RolePreference.Primary).GroupBy(objects, o => o.Key))
    await node.Mset(nodeObjects);

Disclaimer

This project is an independent work and is not endorsed, supported, or certified by Redis.

License

This project is licensed under the MIT License.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Respsody.Generators:

Package Downloads
Respsody

General purpose RESP client

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.8 143 2/16/2026
0.0.7 136 2/16/2026
0.0.6 188 12/21/2025
0.0.5 466 12/10/2025
0.0.4-alpha 171 8/22/2025
0.0.3-alpha 236 8/8/2025
0.0.2-alpha 274 8/4/2025
0.0.1-alpha 191 8/3/2025