UOS.FuncStateless.Redis 1.0.6

dotnet add package UOS.FuncStateless.Redis --version 1.0.6
                    
NuGet\Install-Package UOS.FuncStateless.Redis -Version 1.0.6
                    
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="UOS.FuncStateless.Redis" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UOS.FuncStateless.Redis" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="UOS.FuncStateless.Redis" />
                    
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 UOS.FuncStateless.Redis --version 1.0.6
                    
#r "nuget: UOS.FuncStateless.Redis, 1.0.6"
                    
#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 UOS.FuncStateless.Redis@1.0.6
                    
#: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=UOS.FuncStateless.Redis&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=UOS.FuncStateless.Redis&version=1.0.6
                    
Install as a Cake Tool

UOS Func Stateless CRUD Redis CSharp SDK

用法

1.安装 UOS Func Stateless CRUD Redis CSharp SDK

dotnet add package UOS.FuncStateless.Redis

2.引用本 SDK 并连接 Redis Client

// If you do not specify a databaseId, the sdk will automatically search for and connect to an available database.
// 如果没有指定 databaseId 的话,sdk 会自动获取可用的数据库进行连接。
// Please note: if uos is authorized to store your database password in an encrypted form, this SDK will automatically fill in the password, if not authorized, you will need to specify the database password in your code.
// 注意:如果uos被授权以加密形式存储您的数据库密码,本sdk将自动填入密码,如果未被授权,您需要在代码中指定数据库密码。
// Please note: if there are multiple available databases, you must use the databaseId to specify the desired database you wish to connect to.
// 注意:如果有多个可用数据库的话,请在代码中指定要用于连接的数据库的 databaseId
// Please note: if you already have the database configuration (including id, password, host and port), you can use the corresponding GetConnection method.
// 注意:如果您已知数据库的 config(包括id, password, host, port),可以选择对应的 GetConnection 方法。
// 请填写实际的 databaseId, databasePassword 等参数。
var databaseId = "";
var databasePassword = "";
var conn = await RedisClientManager.GetDatabase(databaseId, databasePassword);
// var host = "";
// var port = 0;
// var conn = await GetDatabase(databaseId, databasePassword, host, port);

3.使用 Redis Client 操作数据库

例:

try
{
    var conn = await RedisClientManager.GetDatabase(databaseId, databasePassword);
    var db = conn.GetDatabase(0);
    string key = "myKey";
    string value = "Hello, Redis!";
                
    db.StringSet(key, value);

    string result = db.StringGet(key);
    Console.WriteLine($"db query result: the value of '{key}' is: {result}");
}
catch (Exception e)
{
    Console.Error.WriteLine(e);
}

4.完整操作示例

/*
环境变量(自动生成):
Environment.GetEnvironmentVariable("UOS_APP_ID") = "8972b2ba-0000-0000-0000-1274083a2c09";
Environment.GetEnvironmentVariable("UOS_APP_SECRET") = "9e131ad6-0000-0000-0000-936df2b1e70a";
Environment.GetEnvironmentVariable("UOS_APP_SERVICE_SECRET") = "f4f57f44-0000-0000-0000-d469d7b45053";
*/
public static async Task Main()
{
    // If you do not specify a databaseId, the sdk will automatically search for and connect to an available database.
    // 如果没有指定 databaseId 的话,sdk 会自动获取可用的数据库进行连接。
    // Please note: if uos is authorized to store your database password in an encrypted form, this SDK will automatically fill in the password, if not authorized, you will need to specify the database password in your code.
    // 注意:如果uos被授权以加密形式存储您的数据库密码,本sdk将自动填入密码,如果未被授权,您需要在代码中指定数据库密码。
    // Please note: if there are multiple available databases, you must use the databaseId to specify the desired database you wish to connect to.
    // 注意:如果有多个可用数据库的话,请在代码中指定要用于连接的数据库的 databaseId。
    var databaseId = "";
    var databasePassword = "";
    try
    {
        var conn = await RedisClientManager.GetDatabase(databaseId, databasePassword);
        var db = conn.GetDatabase(0);
        string key = "myKey";
        string value = "Hello, Redis!";
                
        db.StringSet(key, value);

        string result = db.StringGet(key);
        Console.WriteLine($"db query result: the value of '{key}' is: {result}");
    }
    catch (Exception e)
    {
        Console.Error.WriteLine(e);
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 272 8/5/2025
1.0.5 151 7/31/2025
1.0.4 272 9/14/2024
1.0.3 167 8/19/2024
1.0.2 171 8/16/2024